Hello All,
I've encountered a strange behaviour from g++ that doesn't make sense to me. Maybe you can shed some light on it:
I have a bunch of source files and want to compile them and link them with a static library liba.a located in /usr/local/lib64 into an executable
Approach 1 works fine:
g++ -c file1.cc
g++ -c file2.cc
g++ -c file3.cc
g++ -o executable file1.o file2.o file3.o -la
Approach 2 doesn't work:
g++ -o executable file1.cc file2.cc file3.cc -la
That causes a load of undefined references, It's a shame, because method 2 is what my makefile produces.
Can anyone tell me the difference between 1 and 2 and how to fix it?
Thanks a lot,
Bjorn