This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Link Error on Linux[SOLVED]

Tags: solved solved solved
(comma "," separated)
BreakDS
Registered Member
Posts
2
Karma
0

Link Error on Linux[SOLVED]

Thu Oct 07, 2010 9:52 pm
Hi,

After setting up eigen library to a correct place, I wrote simple c++ code to test it. However never succeeded.

To simplify the problem, the test code is:


#include <Eigen/Core>
using namespace Eigen;
int main( int argc, char* argv[] ){
return 0;
}

This is fine if I just do the compilation:
g++ -c -I $HOME/local/include/ eigen_test.cpp

but when I try to link it:
$ g++ eigen_test.o -O eigen_test

I got nothing but complains on:
Code: Select all
eigen_test: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o:(.text+0x0): first defined here
eigen_test: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o:(.fini+0x0): first defined here
eigen_test:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o:(.rodata.cst4+0x0): first defined here
eigen_test: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o:(.data+0x0): first defined here
eigen_test:(.rodata+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbegin.o:(.rodata+0x0): first defined here
eigen_test: In function `main':
(.text+0x144): multiple definition of `main'
eigen_test.o:eigen_test.cpp:(.text+0x0): first defined here
/usr/bin/ld: Warning: size of symbol `main' changed from 18 in eigen_test.o to 31 in eigen_test
eigen_test: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o:(.init+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
eigen_test:(.dtors+0x8): first defined here
collect2: ld returned 1 exit status


Is there anyone can help me out by telling me why the link process fails to work?
As I have no idea where does the multiple definition come from.

Thanks a lot.

Last edited by BreakDS on Fri Oct 08, 2010 6:26 pm, edited 1 time in total.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Link Error on Linux

Fri Oct 08, 2010 6:29 am
you used a capitalized O in -O, this one is correct:

$ g++ eigen_test.o -o eigen_test
BreakDS
Registered Member
Posts
2
Karma
0

Re: Link Error on Linux

Fri Oct 08, 2010 6:26 pm
ggael wrote:you used a capitalized O in -O, this one is correct:

$ g++ eigen_test.o -o eigen_test


Thanks ~ I didn't notice that.
Sorry for making this kind of mistake. ^_^


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]