gcc pathing problem?

Joel Goguen jtgoguen at gmail.com
Wed Jun 15 16:14:02 UTC 2005


I'm with Ziyad on this one, what command are you using to compile?  And
what version of GCC are you using?  Just for curiosity's sake, let us
know the command you're using to compile your test file and also run 
	g++ --version
and give only the first line of the resulting output.  It should look
something like this:
	g++ (GCC) 4.0.1 20050517 (prerelease) (Debian 4.0.0-7ubuntu6~5.04ubp1)

Here's what I did from the first code sample you gave:
-- Changed '#include <iostream.h>' to '#include <iostream>' since you
don't need the .h suffix here.
-- added 'using namespace std;' right under that, to save me from adding
'std::' in front of every cout (I'm lazy :) )
-- compiled using the command 'g++ test.cpp' which compiled using GCC
3.3.5
-- ran the resulting a.out executable
-- recompiled using 'g++-4.0 test.cpp' and ran that executable
I got identical outputs for both:
----
The size of an int is:          4bytes
The size of a short             2bytes
The size of a long is:          4bytes
The size of a char is:          1bytes
The size of a float is:                 4bytes
The size of a double is:                8bytes
----

On Wed, 2005-15-06 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

--
Joel Goguen
ITS Student Consultant
Bachelor of Computer Science III
University of New Brunswick





More information about the ubuntu-users mailing list