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

I write this code to read 3 files, TM is the size of square matrix, LER the No. of rows of an array and from last value define a non-square matrix of (ler/2)*2

Then... the code read a file with some relations, all are numbers and are assign to C[ler].

Then ... C[ler] is assigned to B[ler/2][2].

Those coordinates, per row, in B[ler/2][2] are assign to a and b.

a and b are the row and the column of the matrix A[tm][tm] where to add 1.

My code crashes and I don't see what the error is.

When I try to compile it, the compiler gcc -g -o MatSim MatSim.cpp prompted:

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

Also, when I try to compile it, the 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 to `std::ios_base::Init::Init()'
MatSim.cpp:(.text+0x17ad4f): undefined reference to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status

Solution

The main problem was a library problem, Compile your code using:

 g++ -g -o MatSim MatSim.cpp -lstdc

Still not working? Install libraries:

sudo apt-get install g++-multilib

This question is related to c matrix coredump

The answer is


Most of these linker errors occur because of missing libraries.

I added the libstdc++.6.dylib in my Project->Targets->Build Phases-> Link Binary With Libraries.

That solved it for me on Xcode 6.3.2 for iOS 8.3

Cheers!


Examples related to c

conflicting types for 'outchar' Can't compile C program on a Mac after upgrade to Mojave Program to find largest and second largest number in array Prime numbers between 1 to 100 in C Programming Language In c, in bool, true == 1 and false == 0? How I can print to stderr in C? Visual Studio Code includePath "error: assignment to expression with array type error" when I assign a struct field (C) Compiling an application for use in highly radioactive environments How can you print multiple variables inside a string using printf?

Examples related to matrix

How to get element-wise matrix multiplication (Hadamard product) in numpy? How can I plot a confusion matrix? Error: stray '\240' in program What does the error "arguments imply differing number of rows: x, y" mean? How to input matrix (2D list) in Python? Difference between numpy.array shape (R, 1) and (R,) Counting the number of non-NaN elements in a numpy ndarray in Python Inverse of a matrix using numpy How to create an empty matrix in R? numpy matrix vector multiplication

Examples related to coredump

Floating point exception( core dump undefined reference to `std::ios_base::Init::Init()' How do I analyze a program's core dump file with GDB when it has command-line parameters? Core dump file is not generated Core dump file analysis Core dumped, but core file is not in the current directory? How to analyze information from a Java core dump? How to generate a core dump in Linux on a segmentation fault?