static-libraries

Is it possible to unit test a static library project using XCode's SenTestingKit?

雨燕双飞 提交于 2019-11-30 01:29:45
问题 I've created an iOS unit test target for doing logic tests following the steps provided in Apple's documentation. However my build fails and i get the following error: Undefined symbols: "_OBJC_CLASS_$_MyClass", referenced from: objc-class-ref-to-MyClass in LogicTests.o ld: symbol(s) not found collect2: ld returned 1 exit status Ordinarily, if I wanted to use my static library within an application I would include the library.a file, and the headers(including the MyClass.h file...). Is

Why doesn't __attribute__((constructor)) work in a static library?

不打扰是莪最后的温柔 提交于 2019-11-30 00:15:08
问题 In the following example, the program should print "foo called": // foo.c #include <stdio.h> __attribute__((constructor)) void foo() { printf("foo called\n"); } // main.c int main() { return 0; } If the program is compiled like this, it works: gcc -o test main.c foo.c However, if foo.c is compiled into a static library, the program prints nothing. gcc -c main.c gcc -c foo.c as rcs foo.a foo.o gcc -o test foo.a main.o Why does this happen? 回答1: The linker does not include the code in foo.a in

Proper way to link a static library using GCC

ⅰ亾dé卋堺 提交于 2019-11-30 00:10:54
Why is it that some static libraries (lib*.a) can be linked in the same way that shared libraries (lib*.so) are linked (ld -l switch), but some can not? I had always been taught that all libraries, static or not, can be linked with -l..., however I've run into one library so far (GLFW), which does nothing but spew "undefined reference" link errors if I attempt to link it this way. According to the response on this question , the "proper" way to link static libraries is to include them directly, along with my own object files, rather than using -l. And, in the case of the GLFW library, this

Geospatial library for the iPhone

允我心安 提交于 2019-11-29 23:53:26
问题 I'm thinking about creating a location-aware iPhone app that could work offline by coming packaged with a list of points of interest (POIs). The app would read the user's current location from CoreLocation and produce a list of the POIs in order of proximity to the user's current location. I need two basic geospatial functions to get this application off the ground. The first is a function that tests if a point (the user's current location) lies within certain geospatial boundaries. The

Is there a way to determine which version of Visual Studio was used to compile a static library?

南楼画角 提交于 2019-11-29 20:58:13
I have a collection of static libraries (.lib) files one of which may have been built with a different version of Visual Studio. This is causing the code generation of a project that links against all of them to fail. Is there any way to determine which version of Visual Studio was used to compile a static library? James McNellis For release libraries, it's unlikely that you could determine the version. For debug libraries, you can use dumpbin : dumpbin /rawdata:1 library.lib The assembly manifest should be at the beginning of the dump and will contain the version of the CRT the library

Error: “File was built for archive which is not the architecture being linked (armv7s)”

旧街凉风 提交于 2019-11-29 20:16:46
I have built my own Static C++ Library, which is built with the settings: Architectures: armv7, armv7s Build Active Architectures Only: No Support Platforms: iOS Valid Architectures: armv7, armv7s The library project builds well and I got the .a file (I have cleaned the build folder and built the project again to be sure my settings were effective). I have added the library (.a file) to my iOS project, but the project won't build even though I have set the exact same settings on the iOS project: Architectures: armv7s, armv7 Build Active Architectures Only: Yes Support Platforms: iOS Valid

How do I build an app for an old linux distribution, and avoid the FATAL: kernel too old error?

ε祈祈猫儿з 提交于 2019-11-29 18:09:15
I distribute a statically linked binary version of my application on linux. However, on systems with the 2.4 kernel, I get a segfault on startup, and the message: "FATAL: kernel too old." How can I easily get a version up and running with a 2.4 kernel? Some of the libraries I need aren't even available on old linux distributions circa 2003. Is there an apt-get install or something that will allow me to easily target older kernels? The easiest way is to simply install VirtualBox (or something similar, e.g. VMWare),Install CentOS 3 or any suitable old distro with a 2.4 kernel and build/test your

Automating synchronization when developping several libraries and projects at the same time

久未见 提交于 2019-11-29 17:22:15
I want incremental updates of my library files to immediately be applied in all of my projects using them, without having to perform an extra step every time for every one of my projects (such as updating a sub-repository or a JAR file). With the library folder in the LIBS_DIR environment variable: // settings.gradle include ':app', ':lib1', ':lib2' project(':lib1').projectDir = new File(System.getenv('LIBS_DIR'), 'lib1') project(':lib2').projectDir = new File(System.getenv('LIBS_DIR'), 'lib2') ‏‏‎ // build.gradle ... dependencies { compile project(path: ':lib1') compile project(path: ':lib2')

How to build a C library for iOS by Xcode 6?

瘦欲@ 提交于 2019-11-29 15:56:54
I trying to build C library for iOS like the following picture. I have build the liblib.a , but it compile error after I use liblib.a The error log is like the following when I use liblib.a file was built for archive which is not the architecture being linked (armv7): /Users/apk/Desktop/libTest/liblib.a Undefined symbols for architecture armv7: It seems the liblib.a not support for armv7 , but I didn't find the armv7 and the arm64 in Build Setting -> Architectures. How do I build the library of C code for armv7 and use in Objective-C ? ---------------------EDIT--------------------- After I

Accessing linux local file system from java web application

跟風遠走 提交于 2019-11-29 15:38:38
we are using a java library inside a web application which is hosted in apache server.ReadConfFile method in library returns file not found error.The method is as follows public byte[] ReadConfFile() { try { File file = new File("/home/product/api/conf.txt"); if(!file.exists()) return "file not found".getBytes(); byte[] buf = new byte[(int) file.length()]; FileInputStream fis = new FileInputStream(file); fis.read(buf); return buf; } catch (IOException e) { e.printStackTrace(); return null; } } Is local file system access from web application allowed?. If yes , then is there any access