gcc pathing problem?

Ben Miller wheelscribe at gmail.com
Wed Jun 15 13:52:03 UTC 2005


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




On Wednesday 15 June 2005 8:16 am, Morten W. J. wrote:
> So as Collin and Dennis pointed out - I'll just summarize - you should try
> to change
>
> > #include <iostream.h>
> >
> > int main()
> > {
> > // cout << "The size of an int is: \t\t"  <<  sizeof(int)  << "bytes\n";
> >  cout << "The size of a short\t\t"   <<  sizeof(short) << "bytes\n";
> >  cout << "The size of a long is: \t\t"  <<  sizeof(long)<<  "bytes\n>  ";
>
> to
>
> #include <iostream>
>
> int main()
> {
> // std::cout << "The size of an int is: \t\t"  <<  sizeof(int)  <<
> "bytes\n"; std::cout << "The size of a short\t\t"   <<  sizeof(short) <<
> "bytes\n"; std::cout << "The size of a long is: \t\t"  <<  sizeof(long)<<
>  "bytes\n";
>
> OR
>
> #include <iostream>
>
> using namespace std;
>
> int main()
> {
> // cout << "The size of an int is: \t\t"  <<  sizeof(int)  << "bytes\n";
>  cout << "The size of a short\t\t"   <<  sizeof(short) << "bytes\n";
>  cout << "The size of a long is: \t\t"  <<  sizeof(long)<<  "bytes\n";
>
> depending on if you perfer to cludder your code or your namespace. You'll
> have to choose one.
>
> I know you said that you didn't want to change the source, but you would
> have a better life if you did, as that is the way to write C++ programs
> these days.
>
> --
> Morten W. Jørgensen




More information about the ubuntu-users mailing list