G++ Ld: Symbol(S) Not Found for Architecture X86_64

I got a error ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1

You haven't told g++ to compile and link in StackFrame.cpp.

Where you have

$ g++ main.cpp -o main

you should have

$ g++ main.cpp StackFrame.cpp -o main -lstdc++

The addition of -lstdc++ might not be required with newer versions of g++.

C++ compilation error: ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

You didn't link with the test.o.

g++ -c test.cpp -o test.o
g++ mainTest.cpp test.o -o mainTest

or you can do them both at once:

g++ maintest.cpp test.cpp -o mainTest

GCC: Getting ld: symbol(s) not found for architecture x86_64 error on OS X 10.11.5

Your code works fine for me using clang.
What is your command for compilation?

Try

g++ test1.cpp -o test

That works for me.

C++ XCODE ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

The problem was caused by using templates in the header .hpp and implementation .cpp files. After moving the implementation .cpp code into the header and removing the .cpp file it worked. This post helped me fix/understand the issue: c++ template and header files.



Related Topics



Leave a reply



Submit