* Static linking with pthread-win32 (again)
@ 2011-08-01 3:28 Eskes
2011-08-01 4:28 ` PcX
0 siblings, 1 reply; 2+ messages in thread
From: Eskes @ 2011-08-01 3:28 UTC (permalink / raw)
To: pthreads-win32
Hello,
I'm struggling with a problem for a while, and I can't figure it out.
I have a small test program (testpt.c) and I want to have it statically
linked with the pthread library. I use the latest TDM-4.5.2 MinGW
toolchain on WinXP (32) and I created the static lib from the cvs HEAD
version with the 'make clean GC-static' command and placed the
libpthreadGC2.a lib in the proper directory (in my case: /mingw/lib).
When I compile my testcase it keeps complaining about:
$ gcc -c testpt.c
$ gcc -o testpt.exe testpt.o -lpthreadGC2
testpt.o:testpt.c:(.text+0x29): undefined reference to `_imp__pthread_exit'
testpt.o:testpt.c:(.text+0x68): undefined reference to
`_imp__pthread_create'
testpt.o:testpt.c:(.text+0x86): undefined reference to `_imp__pthread_join'
collect2: ld returned 1 exit status
This problem has been mentioned before (mailing list 2010-07-23), Ross
Johnson claimed that this problem was fixed in the cvs head version.
When I create a DLL lib with 'make clean GC' all compiles and runs fine
when I put the genereted pthreadGC2.dll in the same directory. Do I
overlook something or missing a point somewhere? Any help is appreciated.
/* testpt.c (pthread static lib test) */
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void *f1(int *x){
int i = *x;
printf("f1: %d",i);
pthread_exit(0);
}
int main(void){
pthread_t f1_thread;
int i1 = 1;
pthread_create(&f1_thread,NULL,(void*)f1,&i1);
pthread_join(f1_thread,NULL);
return(0);
}
With regards,
John
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Static linking with pthread-win32 (again)
2011-08-01 3:28 Static linking with pthread-win32 (again) Eskes
@ 2011-08-01 4:28 ` PcX
0 siblings, 0 replies; 2+ messages in thread
From: PcX @ 2011-08-01 4:28 UTC (permalink / raw)
To: pthreads-win32
äº 2011/8/1 11:28, Eskes åé:
> Hello,
>
> I'm struggling with a problem for a while, and I can't figure it out.
> I have a small test program (testpt.c) and I want to have it statically
> linked with the pthread library. I use the latest TDM-4.5.2 MinGW
> toolchain on WinXP (32) and I created the static lib from the cvs HEAD
> version with the 'make clean GC-static' command and placed the
> libpthreadGC2.a lib in the proper directory (in my case: /mingw/lib).
> When I compile my testcase it keeps complaining about:
>
> $ gcc -c testpt.c
> $ gcc -o testpt.exe testpt.o -lpthreadGC2
> testpt.o:testpt.c:(.text+0x29): undefined reference to `_imp__pthread_exit'
> testpt.o:testpt.c:(.text+0x68): undefined reference to
> `_imp__pthread_create'
> testpt.o:testpt.c:(.text+0x86): undefined reference to `_imp__pthread_join'
> collect2: ld returned 1 exit status
>
> This problem has been mentioned before (mailing list 2010-07-23), Ross
> Johnson claimed that this problem was fixed in the cvs head version.
> When I create a DLL lib with 'make clean GC' all compiles and runs fine
> when I put the genereted pthreadGC2.dll in the same directory. Do I
> overlook something or missing a point somewhere? Any help is appreciated.
>
> /* testpt.c (pthread static lib test) */
> #include <stdio.h>
> #include <stdlib.h>
> #include <pthread.h>
>
> void *f1(int *x){
> int i = *x;
> printf("f1: %d",i);
> pthread_exit(0);
> }
>
> int main(void){
> pthread_t f1_thread;
> int i1 = 1;
> pthread_create(&f1_thread,NULL,(void*)f1,&i1);
> pthread_join(f1_thread,NULL);
> return(0);
> }
>
> With regards,
> John
>
>
>
If you use static edition, you must add the compiler option:
-DPTW32_STATIC_LIB
As is :
gcc -DPTW32_STATIC_LIB -o testpt.exe testpt.o -lpthreadGC2
--
Best Regards,
PcX
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-01 4:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-01 3:28 Static linking with pthread-win32 (again) Eskes
2011-08-01 4:28 ` PcX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).