www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/29/00:20:04

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Newsgroups: comp.os.msdos.djgpp
From: findleyd AT swbell DOT net
Subject: Problem with cross compile from Linux to DOS
X-Newsreader: News Xpress 2.01
Lines: 64
Message-ID: <u8cX7.1705$aX3.1020420243@newssvr12.news.prodigy.com>
NNTP-Posting-Host: 65.69.58.165
X-Complaints-To: abuse AT prodigy DOT net
X-Trace: newssvr12.news.prodigy.com 1009602202 ST000 65.69.58.165 (Sat, 29 Dec 2001 00:03:22 EST)
NNTP-Posting-Date: Sat, 29 Dec 2001 00:03:22 EST
Organization: Prodigy Internet http://www.prodigy.com
X-UserInfo1: TSU[@I_A\S AT _RRPXJBHN_ZD@USXHQD\MNPWZKB]MPXHZUYICD^RAQBKZQTZTX\_I[^G_KGFNON[ZOE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ AT CD^HKANYVW AT RLGEZEJN@\_WZJBNZYYKVIOR]T]MNMG_Z[YVWSCH_Q[GPC_A AT CARQVXDSDA^M]@DRVUM AT RBM
Date: Sat, 29 Dec 2001 05:03:22 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am trying to cross-compile a C++ program on a Linux (Redhat 6.0) PC to DOS.  
After some difficulty with include files, I got djgpp to compile, and 
successfully cross-compiled a test C program, which ran OK in DOS.  However, 
when I try to compile a simple C++ program, none of the basic C++ classes are 
found.  I am including my source, make file and the resultant error output.  
Can anyone tell me what I am missing? Thanks.

------------------------------- Source File --------------------------------
#include <iostream.h>
int main (void)
{   
    cout << "Hello world " << endl;
    return 0;
}

------------------------------ Makefile ------------------------------------
TARGET = testx
C++ = i586-pc-msdosdjgpp-g++ -v
CXXFLAGS =  -g \
            -I /usr/include/g++-2 \
            -I /usr/include \
            -I /usr/local/include
LDFLAGS =   
ALLFLAGS = $(CXXFLAGS) $(LDFLAGS)
# Main object
MOBJ =          test.o
# Function objects
FOBJ =          
# Combined object list
POBJ =          $(MOBJ) $(FOBJ)

##############################################################################
#
# Primary Make Options
##############################################################################
#
default:        $(TARGET)
all:            $(TARGET) 
$(TARGET):      $(POBJ)         
$(C++) -o $(TARGET) $(POBJ) $(ALLFLAGS) 
$(POBJ):  

--------- Output from make -------------------

i586-pc-msdosdjgpp-g++ -v -o testx test.o  -g -I /usr/include/g++-2 -I 
/usr/include -I /usr/local/include  
Reading specs from /usr/local/lib/gcc-lib/i586-pc-msdosdjgpp/2.8.1/specs
gcc version 2.8.1
 /usr/local/i586-pc-msdosdjgpp/bin/ld -o testx 
/usr/local/i586-pc-msdosdjgpp/lib/crt0.o 
-L/usr/local/lib/gcc-lib/i586-pc-msdosdjgpp/2.8.1 
-L/usr/local/i586-pc-msdosdjgpp/lib test.o -lstdc++ -lm -lgcc -lg -lc -lgcc
test.o: In function `main':
test.cpp:2: undefined reference to `endl(ostream &)'
test.cpp(.text+0x1e): undefined reference to `cout'
test.cpp(.text+0x23): undefined reference to `ostream::operator<<(char 
const*)'
test.cpp(.text+0x2e): undefined reference to `ostream::operator<<(ostream 
&(*)(ostream&))'
make: *** [testx] Error 1

------------------------------------------------------------------------
libstdc++.a is on /usr/local/lib/gcc-lib/i586-pc-msdosdjgpp/2.8.1
linked to  /usr/lib/libstdc++-2-libc6.1-1-2.9.0.a

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019