From help-octave-request at bevo dot che dot wisc dot edu Tue Jan 21 10:23:59 2003 Subject: Re: Library libg2c leads double definition of main routine. From: To: Kohei Taki cc: "help-octave at bevo dot che dot wisc dot edu" , jwe@bevo.che.wisc.edu Date: Tue, 21 Jan 2003 11:22:24 -0500 (EST) I'm having similar problems. Where can i find documentation on using octave in C/C++ programs? --------------------------- Matthew Wollenweber mwollenw at cs dot loyola dot edu On Mon, 20 Jan 2003, Kohei Taki wrote: > Hello. > > I want to use octave as class library for C++. > But, using compiler link option for libg2c leads me below error. > % g++ -I/usr/include/octave-2.1.35/ -L/usr/lib/octave-2.1.35 -loctave -lcruft \ > -loctinterp -lreadline -lcurses -llapack -lblas -ldl -lg2c \ > -L/home/pippin/name/.redhat/SOURCES/octave-2.1.35/kpathsea -lkpathsea \ > hello.cpp > /usr/lib/gcc-lib/i386-redhat-linux/2.96/libg2c.a(main.o)(.text+0x0): first defined here > /usr/bin/ld: Warning: size of symbol `main' changed from 58 to 174 in /tmp/ccvCth5v.o > collect2: ld returned 1 exit status > % > The compiler tell me that main routine already defined at libg2c. > I use strings command for libg2c. > % strings /usr/lib/gcc-lib/i386-redhat-linux/2.96/libg2c.a | grep main > main > main.o/ 101865...... > main.c > main > % > It is true what the compiler said, > how have you solve this problem ? > The C++ source code expresses following simple logic. > ==========begin hello.cpp============= > #include > #include > #inlcude > int main() { > Matrix m(2, 2, 1.0); > cout << "hello octave !" << endl < m; > return 0; > } > ==========end hello.cpp=============== > > Please give me advises to overcome this error message. > > ---- > Kohei Taki k-taki at ics dot es dot osaka-u dot ac dot jp > > > > ------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. > > Octave's home on the web: http://www.octave.org > How to fund new projects: http://www.octave.org/funding.html > Subscription information: http://www.octave.org/archive.html > ------------------------------------------------------------- > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------