static-libraries

OpenCV compliation on linux: how to feed to it specific zlib lib?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 15:24:39
问题 I want to compile OpenCV with same zlib as I use for compilation of Boost Iostreams (not system default one). I want to compile OpenCV as static lib, having zlib compiled as static lib. Currently I use something like : ../$CMAKE_PATH -DCMAKE_INSTALL_PREFIX=./$OPENCV_INSTALL_SUBDIR -DBUILD_WITH_STATIC_CRT=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_PYTHON_SUPPORT=OFF -DOPENCV_EXTRA_C_FLAGS=-fPIC -DOPENCV_BUILD_3RDPARTY_LIBS=TRUE make make install echo Done! I wonder: having some $ZLIB_HEADERS and $ZLIB

Static class member variable in static library not shared?

佐手、 提交于 2019-12-11 11:34:42
问题 In a previous question, I described a problem that static member variables of a class did actually have different values for different other classes including them. Upon further research, I found out that the translation unit containing the class with the static member variable gets compiled to a static library (.a extension). Other translation units (lets call them plugins, I am working in a rather complex framework named ADTF) that get compiled and linked later on include this library. My

linkning linux static libraries in windows with cygwin

只谈情不闲聊 提交于 2019-12-11 09:59:27
问题 I'm having a binary static library libfoo.a compiled for 32 bit linux machine. I wish to compile it against my win32 project compiled with cygwin. Is that possible? It seems to be possible, as all the object files in the archive should be in the standard ELF format. However I keep recieving linking errors about functions that nm finds in the libfoo.a . When I created a stub libfoo.a with some empty functions with the same names of those in libfoo.a , I didn't recieve linking errors about

How do I detect, at runtime, that a framework has been loaded?

余生长醉 提交于 2019-12-11 09:26:23
问题 I'm building a static library to distribute to other folks to use in iOS apps, wherein I'd like to take advantage of of frameworks only if they have been included in the app by the users of my library. I've figured out how to compile the library so that it does not itself include any frameworks, but as soon as I try to use it in an app, it fails, because the library references frameworks that don't exist. I'd rather not force my clients to load frameworks they don't need. Weak-linking

Using a .pch file of static library in other project

你离开我真会死。 提交于 2019-12-11 09:09:56
问题 How can I use a .pch file of a static library in another project,which is using the library. 回答1: In the project build settings, search for "pch". There will be an item "Prefix Header" where you should enter the name of your PCH file. 来源: https://stackoverflow.com/questions/22400925/using-a-pch-file-of-static-library-in-other-project

Friend function access the private members of class defined in static library

假装没事ソ 提交于 2019-12-11 08:19:34
问题 I have a static library written in C++. I have also got the header files for the classes defined in the static library. Can I access the private members of the classes defined in the static library introducing a friend function in class declaration ? 回答1: You mean you want to change the headers that are shipped with the library? It's in no way guaranteed that adding friend declarations there will work. You might mess up the linking part, even if your compiler says it's ok. Also, if those

How to build a shared and a static library without recompiling the sources with CMake

别等时光非礼了梦想. 提交于 2019-12-11 08:18:33
问题 I want to build both a static and shared version of the same library as described here. However, the sources are compiled twice, one for each version which is not necessary. Any ways of avoiding this ? 回答1: Depends on the platform. On Linux at least, you need to use different compiler flags to produce position-independent (shared library) than ordinary (program or static library) code. 来源: https://stackoverflow.com/questions/8912938/how-to-build-a-shared-and-a-static-library-without

Create 32-bit and 64-bit Static Library for Devices and Simulators - Xcode

邮差的信 提交于 2019-12-11 07:53:21
问题 I've got this SDK that supports 64-bit. For whatever reason, the library does not build on iOS simulators. To circumvent this I've created my own static library that instantiates the headers and implements everything. This method has always worked and allowed me to build and run the project on a simulator and devices (The standard library is used for devices and my static library is used for simulators). Now that we have 64-bit and 32-bit devices and simulators, my static library does not

Visual C++ 9.0 (2008) Static Lib + Boost Library = Large .lib File

末鹿安然 提交于 2019-12-11 06:48:49
问题 I have a Visual Studio 2008 C++ project that outputs a static library and uses some functionality of the Boost Library. When I build the project in Debug configuration, the .lib file is 7.84 MB. When I build the project in Release configuration, the .lib file is 23.5 MB. !!!! The only Boost headers I include are: boost/function.hpp boost/exception/all.hpp Since this is a static library, I don't have any Boost library files specified to include, but somehow it's a ginormous output. When I use

Undefined references in static OpenCV libraries

大憨熊 提交于 2019-12-11 06:24:44
问题 I have a project in C++ that uses OpenCV 3.1 and works fine using shared libaries. But now I want to compile it using static libraries (located in a folder within the project directory) because I want to be able to export it (and also edit and recompile if necessary) where OpenCV is not installed. I have recompiled OpenCV this time setting shared libs to NO: make -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=NO -DCMAKE_INSTALL_PREFIX=~/Desktop/ocv .. Then I took my required libraries: