Author: Robert Hyatt
Date: 20:35:10 11/15/99
Go up one level in this thread
On November 15, 1999 at 19:55:21, James Swafford wrote: >I'm working on creating a Linux port of my engine. > >A few months ago I posted a question concerning the >unix equivalent of MSVC's "beginthread( )." >After some discussion, it was determined that >pthread_create() was what I was looking for. > >At the time I was using a cygnus port of gcc, >which doesn't support pthreads. Consequently, >I put the whole thing on a shelf for a couple of >months while I worked on my GUI. :-) > >Now I'm back at it, and using g++, under Red Hat >Linux. All my source modules compile, but I've >had to remark out a few lines dealing with my >user interface thread and some semaphore objects. >(So I can run test suites, but that's about it). > >I've #included <pthread.h>, and replaced >the beginthread( ) call with >pthread_create(&thread_id,NULL,UIThread,NULL); >where UIThread is the name of my user interface >function. > >One final step, I think: >I need to link the pthread library with my program. >I'm kind of new to Linux, but after poking around >a bit, the only thing I've found that remotely >resembles what I'm looking for is >/usr/lib/libpthread_p.a, but I'm not sure. just add -lpthread to your link step and you are set... ie: gcc -o programe a.o b.o ... z.o -lpthread > >I assume the .a extension means that the file is >archived. What function do I use to 'unarchive'? .a files are lib files. add the link option -lxxx and the linker (ld) will look for a file libxxx.a and link against it. > >Is this the file I need to link with my program? >If not, what is? Either way, how do I link it with >my program? I'm guessing that I just need to add >the object file into my make file. > >Help *greatly* appreciated. > >On a side note, g++ doesn't recognize the 'fcloseall( )' >function, but does recognize the 'fclose( )' function. >Does 'fcloseall( )' exist in Linux? Maybe I'm not >including the right header... no such posix animal that I know of... you can either do explicit closes, or just call exit(0); to terminate your program and linux will close the files just fine. > >Thanks again. :-/ > >-- >James
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.