[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Library libg2c leads double definition of main routine.
From: |
Kohei Taki |
Subject: |
Library libg2c leads double definition of main routine. |
Date: |
Mon, 20 Jan 2003 16:59:14 -0600 |
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<iostream>
#include<octave/config.h>
#inlcude<octave/Matrix.h>
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 address@hidden
-------------------------------------------------------------
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
-------------------------------------------------------------
- Library libg2c leads double definition of main routine.,
Kohei Taki <=