+ 19
How to solve linker errors in c++?
6 Answers
+ 3
Linker errors generally occur due to following reasons:
->Referenced function definition is not found
-> .o file is not linked
You can start by checking
-> the .cpp file has main()
-> .o file is linked
-> function for which linker error is shown is defined and spelled correctly with correct parameters in the call.
+ 3
Pal I was just saying that if you compile .cc or .cpp files into .o object files and then try to link them all to build an executable which also depend on some static libraries e. g. with a .a extension and different .o files have dependencies on the .a libraries, then where you place the -l switches in the call to gcc e. g. in the Makefiles is important.
+ 2
Linking libraries to the final executable along with .o files can be a nightmare especially as the order in which these libraries are specified matters.
+ 1
Monic thanks for sharing. I have used Visual studio... so new for unix based conpilers. Could you please share any other points you know about the question?
+ 1
ok :) thanks
- 1
hello