static-libraries

Does static library avoids name mangling issues?

旧街凉风 提交于 2021-02-19 08:34:20
问题 I have a C++\MFC application written in Visual Studio 2003 SP1 links to an external static library "SomeExtStaticLib.lib". I also include the header files provided with "SomeExtStaticLib.lib" to create the objects in my application. SomeExtStaticLib.lib is a static library built with VC6. Now, I am migrating my application to Visual Studio 2008. I have very basic question. Should I also migrate the "SomeExtStaticLib.lib" to VS2008 compiled one? When I tried to use this VC6 compiled

convert an std::string to a Swift String

天大地大妈咪最大 提交于 2021-02-19 04:24:26
问题 Short version: how can I convert an std::string (object returned by a .cpp function called from a .Swift file using bridging) to a Swift String ? Long version: I have a library written in C++ and I have to call some code using Swift. I created a bridge, adding two files in my Xcode projects: a bridging header, which allows Swift to call C functions (afaik Swift can't call C++ functions directly, so it needs to pass through C functions) //file bridgingHeader.h const char * getLastOpenedFile();

Linker error when trying to use ImageMagick as static libraries with Visual Studio compiler

微笑、不失礼 提交于 2021-02-08 10:12:55
问题 This question has already been asked here, but since I have many more details to provide, I think it is best to start with a new question. I have trouble linking the ImageMagick lib files in my program that uses the Visual Studio MSVC 2015 compiler. Here are the steps I have followed: I have compiled the static MT runtimes by using the "configure.exe" utility and built in Visual Studio the solution it generated, "VisualStaticMT.sln". This creates lib files such as "CORE_RL_Magick++_.lib" in C

How to “combine” two static libraries?

浪子不回头ぞ 提交于 2021-02-08 09:54:38
问题 so I know that you can't depend a static library to another one but i was wondering if there is something that lets me combine them together. I am trying to setup a game engine project file in vstudio 2019 and i want to compile it as a static library. I need in some way to combine it with SDL 2 library because I want create some systems using SDL. Is there a way I can do that? Thanks for the help. 回答1: When creating a library, you can specify "Additional dependencies" in the "Librarian"

To build the program with a static lib, libcurl.lib

心已入冬 提交于 2021-02-08 08:17:05
问题 I tried to build a stanalone program with a static lib , libcurl.lib . But I got bunch of errors. I ever refered to the related posts on stackoverflow and libcurl homepage, unfortunately it is in vain so far. The following is my building procedure and the error message I got. Please comments. Thank you a lot, 1. Build curl from source code nmake /f Makefile.vc mode=static VC=14 ENABLE_SSPI=no ENABLE_IPV6=no ENABLE_IDN=no GEN_PDB=no DEBUG=no MACHINE=x64 2. Build main.obj CimXml.obj CimCurl.obj

To build the program with a static lib, libcurl.lib

北战南征 提交于 2021-02-08 08:14:11
问题 I tried to build a stanalone program with a static lib , libcurl.lib . But I got bunch of errors. I ever refered to the related posts on stackoverflow and libcurl homepage, unfortunately it is in vain so far. The following is my building procedure and the error message I got. Please comments. Thank you a lot, 1. Build curl from source code nmake /f Makefile.vc mode=static VC=14 ENABLE_SSPI=no ENABLE_IPV6=no ENABLE_IDN=no GEN_PDB=no DEBUG=no MACHINE=x64 2. Build main.obj CimXml.obj CimCurl.obj

cmake link against dll/lib

我怕爱的太早我们不能终老 提交于 2021-02-07 12:26:18
问题 The output of my cmake is a static library. I'm creating it as such: add_library(myMainLib STATIC ${BACKEND_SOURCES}) Problems arise when I try to get myMainLib to link against a third party lib/dll. The dll file will be found at run time, however, I'm trying to import/link against the lib file, with no success. My third party library is SDL2 and SDL2 NET. I would think this is straight forward and have exhausted all methods I've found online. All fail. A list of what I've tried is below.

How to use external libraries and headers in C Makefile?

♀尐吖头ヾ 提交于 2021-02-07 08:19:31
问题 I have a header file myheader.h and a static library libmylib.a file in directory1. In directory2, I'm writing a program which uses them. Suppose I have main.c in directory2 which uses myheader.h and libmylib.a. How do I create a Makefile to compile and link them? Right now, in my main.c, I have added #include "../directory1/myheader.h" Here's my Makefile at the moment: CC = gcc INCLUDES = -I CFLAGS = -g -Wall $(INCLUDES) main: main.o ../directory1/libmylib.a $(CC) main.o ../directory1

Xcode linking against static and dynamic library

*爱你&永不变心* 提交于 2021-02-07 08:07:33
问题 I have some problems with linking my macOS app against C libraries. I have several question related to this issue. It is better to link app against dynamic or static libraries taking into account that this will be very custom libraries rather not shared with other apps? I have linked my macOS Xcode app against ~14 static libraries .a and it works fine. I have reconfigured CMakeLists.txt making this libraries and now Xcode project doesn't work. The main change was changing the directory I have

Why does static library contain a main function?

ε祈祈猫儿з 提交于 2021-02-07 02:56:24
问题 I came across a weird static library which contains a main() function (C++). I just wonder what the purpose it is. How does the main() execute? 回答1: From the linker perspective, it doesn't matter where the main function is - it can be in a static library as well as in standalone object file, linker couldn't care less. It produces the executable from object files, no matter where they come from, and in the final executable all the distinction between library/non library symbols is lost. As for