gcc [-O0] ... your switches ... -lTurboC -lm -lncurses -L/usr/X11R6/lib -lX11 -lpthreadIn FreeBSD, you'll have to say "-lc_r" rather than "-lpthread". Note that the actual directories containing header files and libraries of the X-window system may vary, so you may need to alter the "-L" switch or add a "-I" switch to access the appropriate X files.orgcc -DDoNotFixIntegers ... your switches ... -lTurboCu -lm -lncurses -L/usr/X11R6/lib -lX11 -lpthread
The command-line switch "-DDoNotFixIntegers" is optionally used to turn off TurboC's integer datatype conversion macros and (as you may notice) uses a slightly different version of the library. In the past, some GNU "functions" actually implemented as macros have failed to compile with optimization level higher than -O0, when integer datatype conversion is turned on. That's why one of the examples includes -O0 and the other does not. However, this precaution is probably no longer necessary, and you needn't use -O0 unless experiencing problems.
You can see samples of both types of compilation in the provided Makefile. If there are complaints from the compiler, refer to the trouble-shooting section below.
The switch "-lm" is required by only a couple of functions, but there's no harm in using it for everything. The switch "-lncurses" is needed only if you are using the Turbo C functions prototyped in conio.h, while the switches "-L/usr/X11R6/lib -lX11 -lpthread" are needed only if using the functions prototyped in graphics.h. You'll want to remove these switches if they're not used, to enhance your ability to compile the ported program on more platforms. For example, neither ncurses nor Xlib are typically present in a Mac OS X system (though they can be installed with some effort), and compilation of your ported program will therefore typically fail if these compiler switches are included.
Although I'm not entirely sure why you'd want to do it, and though I haven't tried it myself, I think you can probably disable the graphics.h functions in the TurboC library, and replace them with those in the GRX 2D graphics library. In the TurboC library Makefile, remove the compiler switch "-DWITH_X" before compiling the TurboC library. Then install GRX and follow the instructions in GRX's readme.bgi file. I'd be happy to hear from anyone with feedback (pro/con/howto) on this topic, and will post those comments if they seem to be of general interest.
No comments:
Post a Comment