В Thu, 21 Oct 2010 13:32:55 +0200 Erwin Brandenberger <bra...@heag.ch> пишет:
EB> Yes of course, the library will be build: EB> EB> ar cqs libfoo.a foo.o EB> Is compilation fail if you instead -lfoo pass full path to libfoo.a? like LIBS += /path/libfoo.a ??? Look like linker does not found library in path... Try to add -L/path/to/lib But also it look like is not Qt Creator related problem :-) EB> EB> EB> Am Donnerstag, den 21.10.2010, 14:24 +0300 schrieb Alex T.: EB> > Do you have libfoo.a in that directory after compilation? Because it EB> > looks like that you will have only foo.o there. EB> > EB> > On 21 October 2010 14:17, Erwin Brandenberger <bra...@heag.ch> wrote: EB> > The qt creators foo.pro file looks like this: EB> > EB> > QT -= core gui EB> > TARGET = foo EB> > TEMPLATE = lib EB> > CONFIG += staticlib warn_off EB> > unix:DEFINES += RUN_LINUX \ EB> > RUN_UNIX EB> > win32:DEFINES += RUN_NT EB> > EB> > Yes there is a -fPIC option set. Do I have to switch off it ? EB> > How do I do it ? EB> > EB> > gcc -c -pipe -g -w -fPIC -D_REENTRANT -DRUN_LINUX -DRUN_UNIX EB> > -I/usr/share/qt4/mkspecs/linux-g++ -IDESTDIR -I= -I. -o foo.o EB> > foo.c EB> > EB> > EB> > EB> > EB> > Am Donnerstag, den 21.10.2010, 18:53 +1100 schrieb Alexander EB> > 'hatred' EB> > Drozdoff: EB> > EB> > > В Wed, 20 Oct 2010 10:34:06 +0200 EB> > > Erwin Brandenberger <bra...@heag.ch> пишет: EB> > > EB> > > EB> I like to compile c code building a static library and EB> > then linking this EB> > > EB> library from a c++ project. EB> > > EB> EB> > > EB> But for all c-function calls I get undefined reference. EB> > > EB> EB> > > EB> > > What compilation options do you use for build library? Do EB> > you use [in gcc/mingw32 cases] -fPIC EB> > > options for build objects from your foo.c? EB> > > EB> > > EB> The static c-library is referenced by the c++ project in EB> > the .pro file: EB> > > EB> LIBS += -lfoo EB> > > EB> EB> > > EB> EB> > > EB> What goes wrong ? EB> > > EB> EB> > > EB> EB> > > EB> The c files look like this: EB> > > EB> EB> > > EB> int foo(int a) EB> > > EB> { EB> > > EB> return(a); EB> > > EB> } EB> > > EB> EB> > > EB> EB> > > EB> and the header files: EB> > > EB> EB> > > EB> #ifdef __cplusplus EB> > > EB> extern "C" { EB> > > EB> #endif EB> > > EB> EB> > > EB> int foo(int a); EB> > > EB> EB> > > EB> #ifdef __cplusplus EB> > > EB> } /* extern "C" */ EB> > > EB> #endif EB> > > EB> EB> > > EB> EB> > > EB> and the project file parameters: EB> > > EB> EB> > > EB> QT -= core gui EB> > > EB> TEMPLATE = lib EB> > > EB> CONFIG += staticlib EB> > > EB> EB> > > EB> > > -- WBR Alexander Drozdov FIDO: 2:5045/41.84 Site: http://hatred.homelinux.net Site: http://archlinux.org.ru _______________________________________________ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator