X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <26684236.post@talk.nabble.com> Date: Mon, 7 Dec 2009 13:12:11 -0800 (PST) From: Afflictedd2 To: cygwin AT cygwin DOT com Subject: Re: Help with errors while compiling In-Reply-To: <4B1D68ED.8090501@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <26683356 DOT post AT talk DOT nabble DOT com> <4B1D68ED DOT 8090501 AT gmail DOT com> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Well, Now that you say that. I will simplify my makefile, but then it doesn't know what pthread_create is.. or anything related to pthread. C:\Users\Viper\Documents\Cpp\Pthreads>"C:\Program Files\SlickEdit 2009\win\vsbuild" -signal 9009 -command make -f "Makefile" CFG=Debug VSLICKERRORPATH="C:\Users\Viper\Documents\Cpp\Pthreads" make -f Makefile CFG=Debug g++ -c -g -o "Debug/Pthreads.o" Pthreads.cpp Pthreads.cpp:10:21: pthread.h: No such file or directory Pthreads.cpp: In function `void* PrintHello(void*)': Pthreads.cpp:22: error: `pthread_exit' undeclared (first use this function) Pthreads.cpp:22: error: (Each undeclared identifier is reported only once for each function it appears in.) Pthreads.cpp: In function `int main(int, char**)': Pthreads.cpp:27: error: `pthread_t' undeclared (first use this function) Pthreads.cpp:27: error: expected `;' before "threads" Pthreads.cpp:32: error: `threads' undeclared (first use this function) Pthreads.cpp:32: error: `pthread_create' undeclared (first use this function) Pthreads.cpp:39: error: `pthread_exit' undeclared (first use this function) mingw32-make: *** [Debug/Pthreads.o] Error 1 The Pthreads.cpp file is perfect, I've tried it in Linux.. /***************************************************************************** * FILE: hello_arg3.c * DESCRIPTION: * This "hello world" Pthreads program demonstrates an unsafe (incorrect) * way to pass thread arguments at thread creation. In this case, the * argument variable is changed by the main thread as it creates new threads. * AUTHOR: Blaise Barney * LAST REVISED: 01/30/09 ******************************************************************************/ #include #include #include #define NUM_THREADS 8 void *PrintHello(void *threadid) { long taskid; printf("threadid=0x%x\n", threadid); // sleep(1); taskid = (long) threadid; printf("Hello from thread %ld\n", taskid); pthread_exit(NULL); } int main(int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; int rc; long t; for ( t=0;t > Afflictedd2 wrote: > >> I'm trying to build a simple program using pthreads, but I get the >> following >> errors, why? > >> g++ -c -g -o "Debug/Pthreads.o" -I/Cygwin/usr/include Pthreads.cpp > ^^^^^^^^^^^^^^^^^^^^^^ > > Don't do that, for a start. The compiler knows about all the system's > default include directories already, and has them in a carefully-placed > search > order. If you're lucky, it will just ignore that -I option; if you're > unlucky > it might be messing things up. > > If that doesn't fix it you'll need to try and show us a small simple > testcase; sounds like whatever it is, we'd just need the first ten lines > of > your Pthreads.cpp file (up to the #include that prompts the first errors) > in > order to try and reproduce it. > > cheers, > DaveK > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > > > -- View this message in context: http://old.nabble.com/Help-with-errors-while-compiling-tp26683356p26684236.html Sent from the Cygwin list mailing list archive at Nabble.com. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple