static-libraries

“Undefined reference ” to a function defined in static library

与世无争的帅哥 提交于 2020-12-05 09:21:09
问题 I am trying to build a Library to use in an application. I built the library as below, and when i compile the application i get the below error: I have done the beolw things. I use: gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) In Library to be called from application: Here i have lot of modules, but entry point to this library is func() (i.e., main () is replaced with func() so that i can call the module, also func () is not declared as 'static'.) In one of files: int func (); ... int

How can I handle DLL_EXPORT when compiling dll to a static library?

房东的猫 提交于 2020-08-07 09:50:08
问题 I have a project in visual c++ 2010, which contains preprocessor directives in a key header file. Actually, it is the ZMQ source code. The project is normally configured to be a dll, so the header uses DLL_EXPORT's status (defined/not defined). If the project is used to compile a dll, the header can be used by both the dll project or the client code, thanks to the following setup taken from zmq.h: #if defined _WIN32 # if defined DLL_EXPORT # define ZMQ_EXPORT __declspec(dllexport) # else #