public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* pthread declaration  problem
@ 2004-05-11 22:11 jefe goode
  0 siblings, 0 replies; 7+ messages in thread
From: jefe goode @ 2004-05-11 22:11 UTC (permalink / raw)
  To: pthreads-win32

Hi,

I'm a new user of Posix Thread for Win32 (using
pthreadVC.dll) 

A simple test eg does not compile under MS Visual C+
6.0 

The line that fails to compile is

pthread_t tid; //fails to compile
main()
{
}


This implies that the headers are missing or in the
wrong place, but .. they are in the right place

1) the dll pThreadVC.dll is in the c:\windows
directory,
2) the .h files and the .lib file are in the project
directory,
with both LIB and INCLUDE environment variables set to
the project directory.

Does MSVC 6 require any other settings not covered in
the FAQ? Or is there something else needed?

Thanks 

Jefe


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: pthread declaration  problem
  2004-05-12  0:37       ` jefe goode
@ 2004-05-12  1:00         ` Mark Weaver
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Weaver @ 2004-05-12  1:00 UTC (permalink / raw)
  To: jefe goode, pthreads-win32

> Complete program below:
>
> compiler output is 7 errors -- (all type info not
> found -- the other 6 errors are knock-on ones )
>
> C:\PROJECTS\CP3\Thread1\Thread1.cpp(22) : error C2065:
> 'pthread_t' : undeclared identifier
>
>
> Regards and Thanks
>
> Jefe
> --------------- Listing below  --------------
>
> #include "Thread.h"
> #include "pthread.h"
> #include "sched.h"
> #include "semaphore.h"
> #include <stdlib.h>
> #include <unistd.h>
> #include <stdio.h>
>
> #include "stdafx.h"
>  void print_message_function( void *ptr );
>

If using PCH (precompiled headers) under VC6, then all lines before #include
"stdafx.h" are ignored.  Try moving this to the top or turning off PCH.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: pthread declaration  problem
  2004-05-12  0:23     ` Mark Weaver
@ 2004-05-12  0:37       ` jefe goode
  2004-05-12  1:00         ` Mark Weaver
  0 siblings, 1 reply; 7+ messages in thread
From: jefe goode @ 2004-05-12  0:37 UTC (permalink / raw)
  To: Mark Weaver, pthreads-win32

Mark

Complete program below:

compiler output is 7 errors -- (all type info not
found -- the other 6 errors are knock-on ones )

C:\PROJECTS\CP3\Thread1\Thread1.cpp(22) : error C2065:
'pthread_t' : undeclared identifier


Regards and Thanks

Jefe
--------------- Listing below  --------------

#include "Thread.h"
#include "pthread.h"
#include "sched.h"
#include "semaphore.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

#include "stdafx.h"
 void print_message_function( void *ptr ); 

int main(int argc, char* argv[])
{

  pthread_t thread1, thread2;
     char *message1 = "Hello";
     char *message2 = "World";
     
     pthread_create( &thread1, pthread_attr_default,
                    (void*)&print_message_function,
(void*) message1);
     pthread_create(&thread2, pthread_attr_default, 
                    (void*)&print_message_function,
(void*) message2);

  exit(0);
	return 0;
}

void print_message_function( void *ptr )
  {
     char *message;
     message = (char *) ptr;
     printf("%s ", message);
  }

--------- end listing -----------------





 --- Mark Weaver <mark@npsl.co.uk> wrote: > > 
> > 
> > Thanks Mark,
> > 
> > Yes, it fails to compile and  #include "pthread.h"
> is
> > included; 
> > pthread_t tid; //fails to compile
> > 
> > 
> Try posting the complete program together with the
> compiler output.
> 
> Mark 


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: pthread declaration  problem
  2004-05-12  0:13   ` jefe goode
@ 2004-05-12  0:23     ` Mark Weaver
  2004-05-12  0:37       ` jefe goode
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Weaver @ 2004-05-12  0:23 UTC (permalink / raw)
  To: jefe goode, pthreads-win32

> 
> 
> Thanks Mark,
> 
> Yes, it fails to compile and  #include "pthread.h" is
> included; 
> pthread_t tid; //fails to compile
> 
> 
Try posting the complete program together with the compiler output.

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: pthread declaration  problem
  2004-05-11 23:26 ` Mark Weaver
@ 2004-05-12  0:13   ` jefe goode
  2004-05-12  0:23     ` Mark Weaver
  0 siblings, 1 reply; 7+ messages in thread
From: jefe goode @ 2004-05-12  0:13 UTC (permalink / raw)
  To: pthreads-win32

Thanks Mark,

Yes, it fails to compile and  #include "pthread.h" is
included; 
pthread_t tid; //fails to compile


Regards

Jefe
--- Mark Weaver <mark@npsl.co.uk> wrote: > > A simple
test eg does not compile under MS Visual
> C+
> > 6.0 
> > 
> > The line that fails to compile is
> > 
> > pthread_t tid; //fails to compile
> > main()
> > {
> > }
> > 
> > 
> Did you #include <pthread.h>? 


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: pthread declaration  problem
  2004-05-11 22:11 jefe goode
@ 2004-05-11 23:26 ` Mark Weaver
  2004-05-12  0:13   ` jefe goode
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Weaver @ 2004-05-11 23:26 UTC (permalink / raw)
  To: jefe goode, pthreads-win32

> A simple test eg does not compile under MS Visual C+
> 6.0 
> 
> The line that fails to compile is
> 
> pthread_t tid; //fails to compile
> main()
> {
> }
> 
> 
Did you #include <pthread.h>?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* pthread declaration  problem
@ 2004-05-11 22:11 jefe goode
  2004-05-11 23:26 ` Mark Weaver
  0 siblings, 1 reply; 7+ messages in thread
From: jefe goode @ 2004-05-11 22:11 UTC (permalink / raw)
  To: pthreads-win32

Hi,

I'm a new user of Posix Thread for Win32 (using
pthreadVC.dll) 

A simple test eg does not compile under MS Visual C+
6.0 

The line that fails to compile is

pthread_t tid; //fails to compile
main()
{
}


This implies that the headers are missing or in the
wrong place, but .. they are in the right place

1) the dll pThreadVC.dll is in the c:\windows
directory,
2) the .h files and the .lib file are in the project
directory,
with both LIB and INCLUDE environment variables set to
the project directory.

Does MSVC 6 require any other settings not covered in
the FAQ? Or is there something else needed?

Thanks 

Jefe


	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-12  1:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-11 22:11 pthread declaration problem jefe goode
  -- strict thread matches above, loose matches on Subject: below --
2004-05-11 22:11 jefe goode
2004-05-11 23:26 ` Mark Weaver
2004-05-12  0:13   ` jefe goode
2004-05-12  0:23     ` Mark Weaver
2004-05-12  0:37       ` jefe goode
2004-05-12  1:00         ` Mark Weaver

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).