c - undefined reference to `std::ios_base::Init::Init()' -


i write code read 3 files, tm size of square matrix, ler no. of rows of array , last value define non-square matrix of (ler/2)*2

then... code read file relations, numbers , assign c[ler].

then ... c[ler] assigned b[ler/2][2].

those coordinates, per row, in b[ler/2][2] assign , b.

a , b row , column of matrix a[tm][tm] add 1.

my code crashes , don't see error is.

when try compile it, compiler gcc -g -o matsim matsim.cpp prompted:

/usr/include/c++/4.6/iostream:75: undefined reference `std::ios_base::init::init()' /usr/include/c++/4.6/iostream:75: undefined reference `std::ios_base::init::~init()' collect2: ld returned 1 exit status 

also, when try compile it, compiler f77 -o matsim matsim.cpp prompted:

/tmp/cc6ewlkf.o: in function `__static_initialization_and_destruction_0(int, int)': matsim.cpp:(.text+0x17ad4a): undefined reference `std::ios_base::init::init()' matsim.cpp:(.text+0x17ad4f): undefined reference `std::ios_base::init::~init()' collect2: ld returned 1 exit status 

solution

the main problem library problem, compile code using:

 g++ -g -o matsim matsim.cpp -lstdc 

still not working? install libraries:

sudo apt-get install g++-multilib 

you can resolve in several ways:

  • use g++ in stead of gcc: g++ -g -o matsim matsim.cpp
  • add -lstdc++: gcc -g -o matsim matsim.cpp -lstdc++
  • replace <string.h> <string>

this linker problem, not compiler issue. same problem covered in question iostream linker error -- explains going on.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -