static-libraries

Using a static library in Qt Creator

放肆的年华 提交于 2019-12-17 15:23:17
问题 I'm having a hell of a time finding documentation which clearly explains how to use a static library in Qt Creator. I've created and compiled my static library using Qt Creator (New=>Projects\C++ Library=>Set type to "Statically Linked Library"). It compiles and spits out a ".a file". The problem I encounter is when I try to use the library. I have another project that would like to use it (#include files in the library, etc) but I don't know the proper way to link with the library or include

How to force inclusion of an object file in a static library when linking into executable?

寵の児 提交于 2019-12-17 10:40:11
问题 I have a C++ project that due to its directory structure is set up as a static library A , which is linked into shared library B , which is linked into executable C . (This is a cross-platform project using CMake, so on Windows we get A.lib , B.dll , and C.exe , and on Linux we get libA.a , libB.so , and C .) Library A has an init function ( A_init , defined in A/initA.cpp ), that is called from library B 's init function ( B_init , defined in B/initB.cpp ), which is called from C 's main.

c++ undefined references with static library

回眸只為那壹抹淺笑 提交于 2019-12-17 10:23:24
问题 I'm trying to make a static library from a class but when trying to use it, I always get errors with undefined references on anything. The way I proceeded was creating the object file like g++ -c myClass.cpp -o myClass.o and then packing it with ar rcs myClass.lib myClass.o There is something I'm obviously missing generally with this. I bet it's something with symbols. Thanks for any advice, I know it's most probably something I could find out if reading some tutorial so sorry if bothering

Why does GCC create a shared object instead of an executable binary according to file?

余生长醉 提交于 2019-12-17 06:42:43
问题 I have a library I am building. All of my objects compile and link successively when I run either one of: ar rcs lib/libryftts.a $^ gcc -shared $^ -o lib/libryftts.so in my Makefile. I also am able to successfully install them into /usr/local/lib When I test the file with nm, all the functions are there. My problem is that when I run gcc testing/test.c -lryftts -o test && file ./test or gcc testing/test.c lib/libryftts.a -o test && file ./test it says: test: ELF 64-bit LSB shared object

How to properly uninitialize OpenSSL

半世苍凉 提交于 2019-12-17 06:14:08
问题 In my OpenSSL client I have the problem that the very moment I chose to link libeay32 and ssleay32 statically instead of dynamically I got tons of memory leak errors from Visual Leak Detector. I copied the commands from the OP in this thread, but I still had 6 left. Then I added sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); as advised by 4LegsDrivenCat in the same thread and only 4 more were left, all of which are apparently related to loading a trusted certificate which I use to

How can I use an .a static library in swift?

烈酒焚心 提交于 2019-12-17 05:53:11
问题 I want to use my webrtc .a static library in swift. Can you help please? I read you can´t use static libraries in swift, is that true? 回答1: Have you fixed this problem you asked? I meet this problem on today too, and I've fixed it just a moment. If you don't have fixed this problem, you can try the below steps: p.s.: the 2 projects are in the same workspace (the static lib project and the App project), the static lib project is build before the app project. The workspace structure as the pic

How do I tell CMake to link in a static library in the source directory?

空扰寡人 提交于 2019-12-17 05:42:08
问题 I have a small project with a Makefile which I'm trying to convert to CMake, mostly just to get experience with CMake. For purposes of this example, the project contains a source file (C++, though I don't think the language is particularly relevant) and a static library file which I've copied from elsewhere. Assume for argument's sake that the source code to the library is unavailable; I only have the .a file and the corresponding header. My handmade Makefile contains this build rule: main:

Xcode 4 can't locate public header files from static library dependency

丶灬走出姿态 提交于 2019-12-17 03:45:34
问题 Alternate titles to aid search Xcode can't find header Missing .h in Xcode Xcode .h file not found lexical or preprocessor issue file not found I'm working on an iOS application project which came from Xcode 3. I have now moved to Xcode 4 my project builds a number of static libraries. Those static libraries also declare public headers and those headers are used by the application code. In Xcode 3.x the headers were copied (as a build phase) to the public headers directory , then in the

ld: warning: section __DATA/__objc_imageinfo__DATA has unexpectedly large size

天涯浪子 提交于 2019-12-14 04:18:42
问题 Does anyone know what this warning means? It is followed by the error: Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1 This is an Xcode project for the iPad. I only see this when I compile for the simulator, not the device. I have linked a static library (*.a) to this project and that is where I think this is failing. Also, it used to run on the simulator without an issue and I am not sure what changed. All of the compiler output:

Linker Trouble: How to determine where a “/DEFAULTLIB” is coming from

梦想与她 提交于 2019-12-14 03:43:41
问题 I am trying to find a good way to determine what module at link time is causing a certain library to get processed as a "/DEFAULTLIB" as seen in the verbose linker output from Visual Studio. Here is my situation, I have several static library pre-requisites and each has a release and a debug version (BlahD.lib and Blah.lib). For some reason at link time all of the *D.lib's are processed as default libraries even though I am building a release with the non-debug libs specified as "Additional