undefined reference in gnu cross-compiler
Langerholc, Larry
Larry.Langerholc@icn.siemens.com
Fri Jun 11 11:25:00 GMT 1999
I am having problems with my egcs cross-compiler (HP-UX to SCO 3.2). Here's
the output.
The old gcc 2.7.2 worked.
Thanks,
Larry Langerholc
Larry Langerholc (561)-997-3789
e-mail: larry.langerholc@icn.siemens.com
/net/boca04/stp/egcs.1.1.2/bin/i386-unknown-sco3.2v2.0-c++ -Wall
-msoft-float -I.. -I/ccsrc/lcs3/RMH/CIF_lib -I/ccsrc/lcs3/trace
-I/ccsrc/lcs3/lib -I/ccsrc/lcs3/global_inc
-I/ccsrc/lcs3/OS_Dependancy/include/SCO3.2.2
-I/ccsrc/lcs3/OS_Dependancy/include/UNIXinclude -I/ccsrc/lcs3/OS_Dependancy
-DPAD_META_DATA_ -DUNIX -DSCO -DSCO322 ../llsimtoolmain.cpp
../llsimtoolmain.cpp: In function `void splitFile()':
./llsimtoolmain.cpp:78: warning: implicit declaration of function `int
open(...)'
../llsimtoolmain.cpp:85: warning: implicit declaration of function `int
read(...)'
../llsimtoolmain.cpp:97: warning: implicit declaration of function `int
sprintf(...)'
../llsimtoolmain.cpp:104: warning: implicit declaration of function `int
write(...)'
/var/tmp/ccPHNZj6.o(.text+0x222):llsimtoolmain.cpp: undefined reference to
`__eprintf'
/var/tmp/ccPHNZj6.o(.text+0x2fa):llsimtoolmain.cpp: undefined reference to
`__eprintf'
/var/tmp/ccPHNZj6.o(.text+0x33a):llsimtoolmain.cpp: undefined reference to
`__eprintf'
/var/tmp/ccPHNZj6.o(.text+0x3e7):llsimtoolmain.cpp: undefined reference to
`__eprintf'
collect2: ld returned 1 exit status
larry@boca06:
================ The source file ===================
1 //#include <iostream.h>
2 #include <iostream>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <unistd.h>
7 #include <assert.h>
8 using namespace std;
9 char *gInFileName = 0;
10 char *gOutFileName = 0;
11
12 void splitFile (void);
13
////////////////////////////////////////////////////////////////////////
14 static void UsageError ( char *s )
15 {
16 if ( s) cout << "Invalid option " << s << "\n" ;
17
18 cout << "\n";
19 cout << "Usage (mode):\n";
20 cout << "Usage: (split): simtool -s inFileName outFileName\n";
21 cout << endl;
22 exit ( -1);
23 }
24
25 int main (int argc, char *argv[])
26 {
27
28 enum Mode {SPLIT};
29
30 Mode testMode;
31
32 while ( (*++argv) )
33 {
34 /*for each argument while its a dash */
35 if ( (*argv) [0] == '-' )
36 {
37 char *curarg ;
38 for (curarg = argv[0] + 1; *curarg; curarg++)
39 {
40 /*for each letter after a dash */
41 switch ( *curarg)
42 {
43 case 's': // ramp mode
44 testMode = SPLIT;
45 gInFileName = *++argv;
46 gOutFileName = *++argv;
47 assert ( (gInFileName != 0) && (gOutFileName != 0)
);
48 break;
49 case 'h':
50 UsageError (0);
51 break;
52 default :
53 UsageError (curarg);
54 }/*endsw*/
55 }/*endfor*/
56 }/*endif*/
57 }/*endwhile*/
58
59 switch (testMode)
60 {
61 case SPLIT:
62 splitFile();
63 break;
64 default:
65 UsageError (0);
66 break;
67 }
68
69 return 0;
70
71 }
72
73 // ==========================================================
74 void splitFile (void)
75 {
76 int outFileNum = 0;
77
78 int inFile = open (gInFileName, O_RDONLY);
79
80 assert (inFile > 0);
81
82 // the file header format is int
83 int header = 0;
84
85 int bytes = read (inFile, &header, sizeof(header));
86 assert (bytes == sizeof(header));
87
88 // until the end of the file is reached...
89 while ( bytes > 0 )
90 {
91 char *buf = new char[header];
92 bytes = read (inFile, buf, header);
93
94 if ( bytes == header )
95 {
96 char curFileName[256];
97 sprintf (curFileName, "%s.%d", gOutFileName,
outFileNum++);
98 int outFile = open (curFileName,
99 O_WRONLY | O_TRUNC | O_CREAT,
100 0755);
101
102 assert (outFile > 0);
103
104 bytes = write (outFile, &header, sizeof(header));
105 bytes = write (outFile, buf, header);
106 }
107 delete[] buf;
108
109 bytes = read (inFile, &header, sizeof(header));
110 }
111 }
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.
More information about the crossgcc
mailing list