static-libraries

“relocation R_X86_64_32S against ” linking Error

自作多情 提交于 2019-11-26 10:24:58
问题 I\'m Trying to Link a static Library to a shared library , I\'m Getting the Following error /usr/bin/ld: ../../../libraries/log4cplus/liblog4cplus.a(fileappender.o): relocation R_X86_64_32S against `a local symbol\' can not be used when making a shared object; recompile with -fPIC ../../../libraries/log4cplus/liblog4cplus.a: could not read symbols: Bad value collect2: ld returned 1 exit status But this worked on a 32bit machine without any such error. I tried adding The -fPIC flags manually

Xcode: Copy Headers: Public vs. Private vs. Project?

偶尔善良 提交于 2019-11-26 09:19:48
问题 I\'m building a Cocoa Touch Static Library. How should I decide whether to copy a header file as public, private, or project? 回答1: Public: The interface is finalized and meant to be used by your product’s clients. A public header is included in the product as readable source code without restriction. Private: The interface isn’t intended for your clients or it’s in early stages of development. A private header is included in the product, but it’s marked “private”. Thus the symbols are visible

core data in a static library for the iPhone

别等时光非礼了梦想. 提交于 2019-11-26 09:05:49
问题 I\'ve built a static library that makes heavy use of the Core Data framework. I can successfully use the library in my external project, but ONLY if I include the .xcdatamodel file in the main project. That is less than ideal, since the point of the library was to hide implementation details to the maximum possible. In a separate question, I was informed that I cannot bundle resources with a library (which makes complete sense to me now). So is there a way to programatically allow the model

How to static link on OS X

社会主义新天地 提交于 2019-11-26 08:55:48
问题 I\'m trying to link to a static library on OS X. I used the -static flag in the gcc command but I get the following error message: ld_classic: can\'t locate file for: -lcrt0.o collect2: ld returned 1 exit status I looked in the man pages and it reads something like: This option will not work on Mac OS X unless all libraries (including libgcc.a) have also been compiled with -static. Since neither a static version of libSystem.dylib nor crt0.o are provided, this option is not useful to most

Linking libstdc++ statically: any gotchas?

最后都变了- 提交于 2019-11-26 08:43:00
问题 I need to deploy a C++ application built on Ubuntu 12.10 with GCC 4.7\'s libstdc++ to systems running Ubuntu 10.04, which comes with a considerably older version of libstdc++. Currently, I\'m compiling with -static-libstdc++ -static-libgcc , as suggested by this blog post: Linking libstdc++ statically. The author warns against using any dynamically-loaded C++ code when compiling libstdc++ statically, which is something I haven\'t yet checked. Still, everything seems to be going smoothly so

Can you reference Xib files from static libraries on the iPhone?

旧时模样 提交于 2019-11-26 08:09:09
问题 In my app, i currently have all my code separated into a static library, to make it easier to set up the xcode project targets for the actual app and for unit tests for my code. The problem with this is that i want to put most of my xib files in the static library as well, but it seems that when i run my app and try to reference the xib it can\'t find it unless it is included in the actual app\'s target instead of the static library target. Is it possible to have xib files and other resources

Convert a Static Library to a Shared Library?

萝らか妹 提交于 2019-11-26 07:57:54
问题 I have a third-party library which consists mainly of a large number of static ( .a ) library files. I can compile this into a single .a library file, but I really need it to be a single .so shared library file. Is there any way to convert a static .a file into a shared .so file? Or more generally is there a good way to combine a huge number of static .a files with a few .o object files into a single .so file? 回答1: Does this (with appropriate -L's of course) gcc -shared -o megalib.so foo.o

Difference between framework and static library in xcode4, and how to call them

拜拜、爱过 提交于 2019-11-26 06:55:40
问题 I am quite new to xcode and objective-c. I want to ask a very basic question. I saw that when \"linking binary to libraries\" in project settings, there are differences about framework and libraries, imported from other projects in workspace. First question, why is there a framework? And why is there a library? Cannot my library be a framework? And then, from a .h file, how can I call classes from my imported static library? I suppose there must be a prefix, but I couldn\'t find it. Neither

How to compile a static library in linux?

吃可爱长大的小学妹 提交于 2019-11-26 06:54:32
问题 I have a question: How to compile a static library in linux with gcc, i.e. I need to compile my source code into a file named out.a. Is it sufficient to simply compile with the command gcc -o out.a out.c ? I\'m not quite familiar with gcc, hope anyone can give me a hand. 回答1: See Creating a shared and static library with the gnu compiler [gcc] gcc -c -o out.o out.c -c means to create an intermediary object file, rather than an executable. ar rcs libout.a out.o This creates the static library.

gcc will not properly include math.h

时光总嘲笑我的痴心妄想 提交于 2019-11-26 06:38:36
问题 Here is a minimal example outlining my problem test.c: #include <stdio.h> #include <math.h> main () { fmod ( 3, 2 ); } And here is the command I am issuing to compile test.c gcc -lm test.c -o test And here is the output I get when I issue the above command /tmp/ccQmRk99.o: In function `main\': test.c:(.text+0x3e): undefined reference to `fmod\' collect2: ld returned 1 exit status I get the same output if instead I use cc . I am using the following version of gcc gcc-4.6.real (Ubuntu/Linaro 4