Date: Tue, 23 Apr 1996 18:51:42 +1000 From: root Message-Id: <199604230851.SAA07134@linuxbox.nse.com.au> To: djgpp AT delorie DOT com Subject: PDCURSES in a C++ program can it be done with djgpp? Reply-To: naderr AT topaz DOT cqu DOT edu DOT au Hi, As the title says. I have two programs using curses, one in straight C, the other mixture of C & C++. While on other platforms ( Linux with g++-2.7.1.4 ) and with a different DOS compiler ( BCC/TLINK 3.1) I can compile the C++ one, with DJGPP && gxx I can not. Weird I reckon :) Hmm, Ok, I boiled it down to a simplisimus curses program: ( the real program is about 32k so I'm not going to flood the world with it when a simple example has the same effect ( for me ) ) #include #include #include void init_curses(void); void end_curses(void); void init_curses(void) { /* we must initialize the curses data structure only once */ initscr(); /* in general, will want these modes */ start_color(); cbreak(); noecho(); scrollok(stdscr, TRUE); keypad(stdscr, TRUE); } void end_curses(void) { endwin(); } int main(void) { init_curses(); end_curses(); return (EXIT_SUCCESS); } /* eof */ And have tried to compile it as tcurs.cc with gxx and it fails. However, if I compile as tcurs.c with gcc it succeds ... what gives? Hmm, my DGJPP.ENV has the necessary 'include' and 'lib' paths to handle it ( I believe ) ... here it is .... #= Don't edit this line unless you move djgpp.env outside #= of the djgpp installation directory. If you do move #= it, set DJDIR to the directory you installed DJGPP in. #= DJDIR=%:/>DJGPP% +USER=dosuser +TMPDIR=%DJDIR%/tmp +EMU387=%DJDIR%/bin/emu387.dxe +LFN=n [bison] BISON_HAIRY=%DJDIR%/lib/bison.hai BISON_SIMPLE=%DJDIR%/lib/bison.sim [cpp] CPLUS_INCLUDE_PATH=%/>;CPLUS_INCLUDE_PATH%%DJDIR%/lang/cxx;%DJDIR%/include;%DJDIR%/contrib/grx20/include;%DJDIR%/contrib/pdcurs22/include C_INCLUDE_PATH=%/>;C_INCLUDE_PATH%%DJDIR%/include;%DJDIR%/contrib/grx20/include;%DJDIR%/contrib/pdcurs22/include OBJCPLUS_INCLUDE_PATH=%/>;OBJCPLUS_INCLUDE_PATH%%DJDIR%/include;%DJDIR%/lang/objc OBJC_INCLUDE_PATH=%/>;OBJC_INCLUDE_PATH%%DJDIR%/include;%DJDIR%/lang/objc [gcc] COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib;%DJDIR%/contrib/grx20/lib;%DJDIR%/contrib/pdcurs22/lib [info] INFOPATH=%/>;INFOPATH%%DJDIR%/info Is the above correct? And the part of makefile with which I compile this program for DJGPP V2 ###################################################################### ## ## MSDOS ## ## C++ Compiler CXX=gxx ## ## Compiler flags CFLAGS=-O2 -g -Wall ## ## ICURSES= ## ## Linker flags LDFLAGS=-lcurso ## ## Target compiled extension EXE=.exe ## ## ## Object code extension OBJ= ## ## Backup extension BAK=.bak ## RM=rm ## ######################################################################## ## Operating System Independent section ## ## D O N O T E D I T ## ===================== ## C Compiler CC=gcc ## ## C Source file extension CSOURCE=.c ## ## C++ Source file Extension CXXSOURCE=.cc ## ## Program name PROGRAM=tcurs ## ######################################################################### ## ## Nothing to change below this line! ## ######################################################################### .PHONY: all clean all: $(PROGRAM) $(PROGRAM): tcurs.cc $(CXX) $(CFLAGS) $(ICURSES) $@$(CXXSOURCE) -o $@$(EXE) $(LDFLAGS) clean: -$(RM) *~ $(PROGRAM)$(EXT) # eof makefile Or try $(PROGRAM): tcurs.c $(CC) $(CFLAGS) $(ICURSES) $@$(CSOURCE) -o $@$(EXE) $(LDFLAGS) for the pure C style compilation/linking that succeds :) Now, if anyone can please tell me: (1) what am I doing _wrong_ that makes the gxx compile fail and/or (2) make it compile under gxx succesfully or (3) tell me with certainty that it is not going to compile with gxx no matter what I try .... I'll be a happy lad :) < it's driving up the wall :) Thanks in advance, regards, Rob