Re: Question about how to compile multiple files with g++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yen,

Try this...
g++ -Wall -O2 -s main.cpp a.cpp b.cpp

>So, how do I compile this program to generate the objective file? 

Ahh, the above does generate object files, it generates the executable.  To generate the object files of each of those, try this...
g++ -c -Wall -O2 main.cpp
g++ -c -Wall -O2 a.cpp
g++ -c -Wall -O2 b.cpp

And then to get the executable...
g++ -s main.o a.o b.o

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux