static-libraries

How do I tell cmake I want my project to link libraries statically?

女生的网名这么多〃 提交于 2019-12-03 06:38:43
问题 I'm trying to build an OpenCV-based project using CMake, running on Linux. So far my CMakeLists.txt files looks something like FIND_PACKAGE (OpenCV REQUIRED) ... TARGET_LINK_LIBRARIES (my-executable ${OpenCV_LIBS}) but this results in dynamically linked libraries. How do I link with static libraries? 回答1: You build static OpenCV libraries by just setting the BUILD_SHARED_LIBS flag to false in CMake. Then all you need to do to build your own application with those static libraries is to add a

Adding a .lib file to a project in Visual Studio 2015 [duplicate]

流过昼夜 提交于 2019-12-03 06:18:47
问题 This question already has answers here : How to include libraries in Visual Studio 2012? (2 answers) Closed 2 years ago . I have generated a .lib file from another project that I would like to use in my project. I have added the file to Linker → Input → Additional dependencies as bluetoothserialport.lib . I've added the lib file inside my project at this level: http://i65.tinypic.com/1t9fki.jpg However I get the following error: 1>LINK : fatal error LNK1104: cannot open file

How to deal with recursive dependencies between static libraries using the binutils linker?

时光怂恿深爱的人放手 提交于 2019-12-03 05:57:13
问题 I'm porting an existing system from Windows to Linux. The build is structured with multiple static libraries. I ran into a linking error where a symbol (defined in libA) could not be found in an object from libB. The linker line looked like g++ test_obj.o -lA -lB -o test The problem of course being that by the time the linker finds it needs the symbol from libA, it has already passed it by, and does not rescan, so it simply errors out even though the symbol is there for the taking. My initial

How do I create both a .lib file and an .exe file in Visual C++?

北战南征 提交于 2019-12-03 05:42:06
I currently have a console project which creates an .exe file; I want it to also create a .lib file so other projects, compiled as DLLs, would be able to call functions from the original project. I know it is possible, but I couldn't find how to do that. How do I tell the linker to also link a .lib? It's not possible in general - static libraries and executables are completely different kinds of animal. The way to handle this situation is to create two projects - one for the library, which contains all the functionality. and one for the executable, which is a thin wrapper that simply calls

How to create static library for iOS without making all symbols public

梦想与她 提交于 2019-12-03 05:11:53
问题 This question has been asked before, but digging into the documentation for the various development tools it seems like this is possible, just not obvious. Motivation: Making a static library for use by other iOS developers. Some symbols in the library will cause problems if exported so I wish to make them internal-only symbols. With a dynamic library this is easy, just use -exported_symbols_list libtool ( ld ) argument and list the ones you want public. libtool documentation will not allow

Linking a Static C Library in Xcode 7?

一笑奈何 提交于 2019-12-03 03:47:38
I'm currently trying to link a static C library I've created to a fresh Xcode project. To link it, I followed the following instructions: 1) Navigate to Build Phases 2) Expand Link Binaries With Library 3) Added an "other" library, and then specified the .a file in question. Unfortunately, the project won't compile and throws the following error: ld: library not found for -ltxht I'm not sure exactly what to make of this. The library seems to appear okay in the project as a project file, and I can't find any indication that there is anything wrong with that. I've tried setting it's location to

What is a dynamic language, and why doesn't C# qualify?

亡梦爱人 提交于 2019-12-03 03:35:51
问题 Listening to a podcast, I heard that C# is not dynamic language while Ruby is. What is a "dynamic language"? Does the existence of dynamic languages imply that there are static languages? Why is C# a dynamic language and what other languages are dynamic? If C# is not dynamic, why is Microsoft pushing it strongly to the market? As well why most of .NET programmers are going crazy over it and leaving other languages and moving to C#? Why is Ruby "the language of the future"? 回答1: What is a

Building a static library with cocoapods

感情迁移 提交于 2019-12-03 03:17:48
问题 I am trying to build a static library that has different dependencies (AFNetworking for example) specified in a Podfile. I don't want the dependencies to be included in the final static library (call libMyProject.a), I just want to link against them and then create a MyProject.Podspec file where I can put the same dependencies. The problem is that when I build libMyProject.a the libPods.a is linked and included, so that if I distribute libMyProject.a and other people integrates it in a

Add static library to podspec

泪湿孤枕 提交于 2019-12-03 02:49:54
问题 My podspec requires a static library (OpenSSL). For convenience, I'm shipping the library with the pod. The static library contains: Binaries: MyPod/openssl/bin/libcrypto.a and MyPod/openssl/bin/libsll.a Headers: MyPod/openssl/include/openssl/*.h Its own license (in addition to my project's license): MyPod/openssl/include/LICENSE What is the proper way of expressing this in my podspec? I've seen various example that use combinations of the following properties and I'm currently trying

Makefile for a library

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 02:44:58
I have to run these 4 commands on the terminal each time I want to execute the program using libraries. The lines are cc -m32 -c mylib.c ar -rcs libmylib.a mylib.o cc -m32 -c prog.c cc -m32 prog.o -L. -lmylib ./a.out How do I make a makefile for the above commands and run it? A detailed procedure would be appreciated. Thanks. Edit: Here is the solution: a.out: prog.o libmylib.a cc prog.o -L. -lmylib prog.o: prog.c mylib.h libprint_int.a: mylib.o ar -rcs libmylib.a mylib.o print_int.o: mylib.c mylib.h clean: rm a.out prog.o libmylib.a mylib.o This gave an error on line 2 because I used spaces