[Anjuta-list] re: How to build a project with threads



This information is not well documented, but I had the same problem so
I've been up for the last hour trying to figure it out.

In Anjuta, go to the Settings menu, then Compiler and Linker Settings. 
Click the Others tab.  In the Linker flags box, put:

LDFLAGS='-lpthread'

and that's it!  Should build just fine.

Hope it works out for you too...

-Jeff

Miguel Garcia wrote......

 Hi everybody,
 	I am designing my first project with Anjuta; it contains one include 
 file and 6 source code files. Every source code file compiles correctly, 
 but when I try to build the whole project, Anjuta returns me the next 
 messages:
 
 /home/miguel/Projects/ffluxd/src/apiflujos.c:196: undefined reference to 
 `pthread_cancel'
 apiflujos.o(.text+0x397):/home/miguel/Projects/ffluxd/src/apiflujos.c:204: 
 undefined reference to `pthread_kill'
 Reconfig.o(.text+0x34): In function `Reconfigurar':
 /home/miguel/Projects/ffluxd/src/Reconfig.c:42: undefined reference to 
 `pthread_create'
 Parar.o(.text+0x34): In function `Parar':
 /home/miguel/Projects/ffluxd/src/Parar.c:43: undefined reference to 
 `pthread_create'
 Parar.o(.text+0x74):/home/miguel/Projects/ffluxd/src/Parar.c:52: 
 undefined reference to `pthread_join'
 flujo.o(.text+0xef): In function `EjecutaFlujo':
 /home/miguel/Projects/ffluxd/src/flujo.c:51: undefined reference to 
 `_pthread_cleanup_push'
 flujo.o(.text+0x2fb):/home/miguel/Projects/ffluxd/src/flujo.c:98: 
 undefined reference to `pthread_cond_timedwait'
 flujo.o(.text+0x3a6):/home/miguel/Projects/ffluxd/src/flujo.c:118: 
 undefined reference to `pthread_cond_timedwait'
 flujo.o(.text+0x521):/home/miguel/Projects/ffluxd/src/flujo.c:157: 
 undefined reference to `pthread_cond_timedwait'
 

 I can compile my whole code with the next instruction:
 gcc -lpthread -I. file1.c file2.c .....
 
 How can I configure Anjuta in order to build my project properly?
 Do I have to add any header in my source code files?
 or Do I have to add these flags (-lpthread -I.) anywhere?
 
 THANKS IN ADVANCE
-- 
Jeff Tickle
http://www.jtsoft.net
PGP Key FP: 242F B383 3F20 F89F 8BC5 2CB9 775F 663C 0D34 F8D7

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]