how to add 2 DLL's to exe?

Ángel González keisial@gmail.com
Tue Aug 27 13:30:00 GMT 2013


On 27/08/13 13:49, niXman wrote:
> 2013/8/27 joaquim:
>
>> imagine that we have theses source files:
>>
>> main.cpp
>> source1.cpp
>>
>> do i need compile them 1 by 1, or just the main?
> g++ main.cpp source1.cpp -omain

Or, you can also compile them incrementally:

  g++ -c main.cpp -omain.o
  g++ -c source1.cpp -osource1.o
  g++ -o main.exe main.o source1.o

This way a change on source1.cpp doesn't require a compile
of main.cpp (you would only repeat the last two commands)

The program make is designed to automate this way (it uses
a configuration file called Makefile).


And about your other query:
> (i must use """" for considere the space and others characteres.. something
> about VB i think)
"""" in VB generates a single ". You are writing the filenames between
double quotes (so you don't have problems with spaces in the path)

> if i take off the&  " -static", the compiler do the job correctly:(
> so what i'm doing wrong?
-static means that you want everything in one executable. If you leave 
-static
out, the will still link the program, but will (may) produce an 
executable which
requires other libraries.


You can obviouslly create a VB program to produce the compilation line, 
but I feel
you are using the wrong tool. Use either a batch file (for simple 
compiles) or learn
to use a Makefile. It really pays off.



More information about the Gcc-help mailing list