Hi,
I have a relatively simple project I'm trying to compile.
I can compile it easily by hand, but I cannot convince KDevelop to compile it for me.
I have narrowed the error down to problems involving dumping the .o files created by g++ into a "library" with ar.
Below are two scripts which illustrate the problem. The first script works, the second one doesn't... why?
----------------- SCRIPT 1 -- WORKS!!! ---------------------------
g++ -Iscanner/ -Iparser/ -Icommon/ -Isemantics/ -c common/*cpp
g++ -Iscanner/ -Iparser/ -Icommon/ -Isemantics/ -c parser/*cpp
g++ -Iscanner/ -Iparser/ -Icommon/ -Isemantics/ -c scanner/*cpp
g++ -Iscanner/ -Iparser/ -Icommon/ -Isemantics/ -c semantics/*cpp
g++ -Iscanner/ -Iparser/ -Icommon/ -Isemantics/ *o mincc.cpp -o mincc
------------------ SCRIPT 2 -- BROKEN
---------------------------
cd common
g++ -I../scanner/ -I../parser/ -I../semantics/ -c *cpp
ar cru libcommon.a *o
ranlib libcommon.a
cd ..
cd parser
g++ -I../scanner/ -I../common/ -I../semantics/ -c *cpp
ar cru libparser.a *o
ranlib libparser.a
cd ..
cd scanner
g++ -I../parser/ -I../common/ -I../semantics/ -c *cpp
ar cru libscanner.a *o
ranlib libscanner.a
cd ..
cd semantics
g++ -I../scanner/ -I../parser/ -I../common/ -c *cpp
ar cru libsemantics.a *o
ranlib libsemantics.a
cd ..
g++ -Iscanner/ -Iparser/ -Icommon/ -Isemantics/ -c mincc.cpp
g++ semantics/libsemantics.a parser/libparser.a scanner/libscanner.a common/libcommon.a mincc.o -o mincc
My understanding was that ar would just "tar" the .o files together, thus the two should be equivalent... this is not the case.
Why?