static-libraries

How to build and use a C++ static library for ios application

☆樱花仙子☆ 提交于 2019-12-12 08:29:44
问题 I know how to build a object C static library using iOS->Framework&Library->Cocoa Touch Static Library in xcode 4.6, and it is straightforward with the help of this tutorial Creating a Static Library in iOS Tutorial. One thing I am not sure, however, is how to build and use a pure C++ static library for io application. For building a C++ static library, I am also use iOS->Framework&Library->Cocoa Touch Static Library guideline, and the difference is that I delete all the .h and .m files when

Static library having object files with same name (ar)

被刻印的时光 ゝ 提交于 2019-12-12 08:27:47
问题 A bit context. Let's say I have source files, which need to end up in a static library. Let's say there are two cpp files a.cpp and a.cpp located in two different subdirectories. Something like this: foo/a.h foo/a.cpp bar/a.h bar/a.cpp Their content is not clashing and is completely different. The file names are just same. Now, when compiling I end up with two a.o files of course. gcc -c foo/a.cpp -o foo/a.o gcc -c bar/a.cpp -o bar/a.o If I create a static lib now with ar rcs libfoobar.a foo

Function names extraction from static library

☆樱花仙子☆ 提交于 2019-12-12 08:24:13
问题 I have a static library static_library.a How to list functions and methods realized there. or at least how to look is there concrete function 'FUNCTION_NAME' realized? 回答1: Write nm static_library.a This gives you complete list of symbols in the library. 回答2: Use nm <library> as mentioned. If this is a library built from C++ you should use the nm --demangle option to get back the original symbol names rather than their "mangled" versions. 回答3: The nm lists the symbols from object files $ nm

Static library built for archive which is not the architecture being linked (x86_64)

拈花ヽ惹草 提交于 2019-12-12 08:23:36
问题 I am experiencing what seems to be the same problem when I try to compile two different programs. Each of them creates first a static library and then the main application linking that library. I am working on Mac OS Mavericks with gcc 4.7.2. Program 1 This is what is happening when I run make : First, the library libfeat.a is created, but I get a warning: ar rc ../lib/libfeat.a imgfeatures.o utils.o sift.o kdtree.o minpq.o xform.o ranlib ../lib/libfeat.a /Applications/Xcode.app/Contents

static library v.s. import library on Windows platform

百般思念 提交于 2019-12-12 07:49:23
问题 How could I tell one .lib file is a static library v.s. an import library for a DLL? Is there any tool or command that could do this? Second question is how could I check the dependencies of a static library, I mean how could I know which DLLs are included in this static library? Thanks for any help here. Best regards, 回答1: Import library will add a DLL dependency to your program. Your program won't start, if you don't have the DLL. (You may use Dependency Walker to get the names of the DLL's

Creating static libraries

时光毁灭记忆、已成空白 提交于 2019-12-12 07:39:40
问题 I'm trying to create a static library to use inside my PHP extension. To do that, I'm compiling my .c files using gcc -c file.c -o file.o and obtaining .o files. I then use ar rcs lib.a *.o to archive all the compiled objects into an .a file. After doing this, I'm referring to this .a file when compiling my PHP extension, but I get the following error: *** Warning: Linking the shared library <extension>.la against the *** static library lib.a is not portable! If I use the .o files instead of

Distributing Windows C++ library: how to decide whether to create static or dynamic library?

情到浓时终转凉″ 提交于 2019-12-12 07:24:56
问题 We have been converting our Java and .NET API library to C++, and are trying to figure out what is the best way to distribute a compiled version to other developers to use with their custom applications. Should it be a static library or dynamic library? We need to create for both Win32 and Win64 (and I suppose both a Debug and Release version of each target OS). Given all the frustration I've encountered trying to make sure all referenced libraries are matched (/MT versus /MD), I'm wondering

Android NDK: Trying to port JnetPcap

风流意气都作罢 提交于 2019-12-12 07:16:00
问题 I found a traffic monitoring application for Android, Shark: http://sourceforge.net/projects/prueba-android/ which is based on JnetPcap and has a file with all the source files and the appropriate Android.mk files. I put the jni directory in the samples file of the Android-NDK and I tried to build it using ndk-build -C. During the compilation occurs some errors. Here is the error log I take: make: Entering directory `/home/thanasis/android-ndk-r5b/samples /jnetpcap_pure/jni' Compile thumb :

Can I put HLSL into a .lib somehow?

流过昼夜 提交于 2019-12-12 06:23:18
问题 I made a sprite renderer using DirectX and C++ and I would like to put that into a .lib file. Is it possible to somehow put the two (compiled) shaders into the .lib so I don't have to include them everywhere? Right now I read them from disk at runtime which of course means that I have to put the two .cso files somewhere so they can be read. The solution I came up with is to put them into the project as strings and then compile them at runtime but that's not as convenient... 回答1: How about

Uncaught exception in a callback from a 3rd party static library

China☆狼群 提交于 2019-12-12 05:42:41
问题 I am compiling my program with a 3rd party library. That library contains an error callback if an error occurs internally. Inside that error callback I am throwing an exception and I have a unit test to verify that when I do something invalid that the exception is thrown. This all works beautifully in Windows, but when I test this in linux (fedora) I am getting an abort from an uncaught exception. I tried wrapping my call directly with a try-catch block but no luck. ( Also, all my code is