В Wed, 20 Oct 2010 10:34:06 +0200
Erwin Brandenberger <[email protected]> пишет:
EB> I like to compile c code building a static library and then linking this
EB> library from a c++ project.
EB>
EB> But for all c-function calls I get undefined reference.
EB>
What compilation options do you use for build library? Do you use [in
gcc/mingw32 cases] -fPIC
options for build objects from your foo.c?
EB> The static c-library is referenced by the c++ project in the .pro file:
EB> LIBS += -lfoo
EB>
EB>
EB> What goes wrong ?
EB>
EB>
EB> The c files look like this:
EB>
EB> int foo(int a)
EB> {
EB> return(a);
EB> }
EB>
EB>
EB> and the header files:
EB>
EB> #ifdef __cplusplus
EB> extern "C" {
EB> #endif
EB>
EB> int foo(int a);
EB>
EB> #ifdef __cplusplus
EB> } /* extern "C" */
EB> #endif
EB>
EB>
EB> and the project file parameters:
EB>
EB> QT -= core gui
EB> TEMPLATE = lib
EB> CONFIG += staticlib
EB>
--
WBR
Alexander Drozdov
FIDO: 2:5045/41.84
Site: http://hatred.homelinux.net
Site: http://archlinux.org.ru
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator