gcc pathing problem?
ZIYAD A. M. AL-BATLY
zamb at saudi.net.sa
Wed Jun 15 15:42:55 UTC 2005
On Wed, 2005-06-15 at 08:52 -0500, Ben Miller wrote:
> Thank you for your help and education, Morten, Collin, and Dennis. Idont mind
> changing the code, I merely said I hadn't. :-) I also need to look for more
> modern reference books!
>
> As a test I reduced my code to the bare minimum:
> #include <iostream>
>
> int main()
> {
>
> int x;
> return 0;
>
> }
>
>
> Here's the entire error code I receive:
> ccgB2MQC.o(.text+0x35): In function `__static_initialization_and_destruction_0
> (int, int)':
> : undefined reference to `std::ios_base::Init::Init[in-charge]()'
> /tmp/ccgB2MQC.o(.text+0x66): In function `__tcf_0':
> : undefined reference to `std::ios_base::Init::~Init [in-charge]()'
> /tmp/ccgB2MQC.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> collect2: ld returned 1 exit status
> ben at wheelscribe:~/in_c $ gcc memsize.cpp -o memsize
> /tmp/cc7cGKSI.o(.text+0x35): In function
> `__static_initialization_and_destruction_0(int, int)':
> : undefined reference to `std::ios_base::Init::Init[in-charge]()'
> /tmp/cc7cGKSI.o(.text+0x66): In function `__tcf_0':
> : undefined reference to `std::ios_base::Init::~Init [in-charge]()'
> /tmp/cc7cGKSI.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> collect2: ld returned 1 exit status
>
> Once again, your thoughts?
>
> Thanks,
> Ben
>
How do you compile your code? I used your code and it worked perfectly.
Here's how I compiled it:
g++ -o code1 code.cpp
Here's another way that also works (only with GCC 3.0 or newer):
gcc -o code2 -lstdc++ code.cpp
(I really don't know the technical deference between the two ways.)
Hope this helps.
Ziyad.
More information about the ubuntu-users
mailing list