[RESOLVED]how to add 2 DLL's to exe?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[RESOLVED]how to add 2 DLL's to exe?

joaquim
This post was updated on .
i understand the the GCC compiled exe needs the libgcc_s_sjlj-1.dll and libstdc++-6.dll for work. but how can i add them to exe(for the exe don't be dependent of them)?
(for i distribut the programs)
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

niXman
2013/8/27 joaquim:
> i understand the the GCC compiler exe needs the libgcc_s_sjlj-1.dll and
> libstdc++-6.dll for work. but how can i add them to exe(for the exe don't be
> dependent of them)?
> (for i distribut the programs)

Use '-static' comand line option when linking.


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
This post was updated on .
niXman wrote
2013/8/27 joaquim:
> i understand the the GCC compiler exe needs the libgcc_s_sjlj-1.dll and
> libstdc++-6.dll for work. but how can i add them to exe(for the exe don't be
> dependent of them)?
> (for i distribut the programs)

Use '-static' comand line option when linking.


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
honestly i'm new with GCC command lines. so try help in these way(sorry, but it's more easy for i understand):

-heres how i compile the resource file:
(RC to RES)

windres my.rc -O coff -o my.res

-compile the source file(i think that i only need the main source file, but correctme):

g++ -c object.o sourcefile.cpp

- for add it to exe:

g++ -o my_app.exe object.o my.res

- so for use that command i do these?

g++ -o my_app.exe object.o my.res -static

i'm correct?
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

niXman
2013/8/27 joaquim:
> g++ -o my_app.exe obj1.o my.res -static
>
> i'm correct?

yes.


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
This post was updated on .
niXman wrote
2013/8/27 joaquim:
> g++ -o my_app.exe obj1.o my.res -static
>
> i'm correct?

yes.


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
thanks for all.. realy thanks.
anotherthing: when i use several source files, i must compile them 1 by 1 or just the main source file?
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

niXman
2013/8/27 joaquim:
> anotherthing: when i use several source files, i must compile them 1 by 1 or
> just the main source file?

I do not understand your question...


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
niXman wrote
2013/8/27 joaquim:
> anotherthing: when i use several source files, i must compile them 1 by 1 or
> just the main source file?

I do not understand your question...


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
imagine that we have theses source files:

main.cpp
source1.cpp

do i need compile them 1 by 1, or just the main?
(sorry my english)
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

niXman
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


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
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


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
i understand. thanks for all.. realy thanks
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
the -static needs the DLL file name?
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

niXman
2013/8/27 joaquim:
> the -static needs the DLL file name?

no.

g++ main.cpp source1.cpp -omain -static


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
see these VB code:


        strCompilerName = App_Path & "\MinGW32\bin\g++.exe"
        strEXEFileName = """" & App_Path & "\test" & """"
        strCPPFonteName = """" & App_Path & "\test.cpp"
        strMainIcon = """" & App_Path & "\MainIcon.res" & """"
        strRC = """" & App_Path & "\MainIcon.rc" & """"
        strResCompilerName = """" & App_Path & "\MinGW32\bin\windres.exe" & """"
(i must use """" for considere the space and others characteres.. something about VB i think)
app_Path is the program folder(where i have the program that will compile).

and see how i use it:
(here you don't see the strCompilerName  because is used in other place... i'm showing these for you understand how i'm doing it;))
"-o " & strEXEFileName & " " & strCPPFonteName & " -static"

if i take off the & " -static", the compiler do the job correctly:(
so what i'm doing wrong?
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

Ángel González
In reply to this post by niXman
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.

Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
it's realy painfull\dificulty to build a compiler lol
i must learn very very lol
but tell me, if you know, what i'm doing wrong in string?

instead use process class, i can use 1 API function for that;)
(sorry ask you again, but maybe we can fix these;))
Reply | Threaded
Open this post in threaded view
|

Re: how to add 2 DLL's to exe?

joaquim
i found my error. was your tip;)
because i forget close it "& """"" in 1 line lol
now works:

 strCompilerName = App_Path & "\MinGW32\bin\g++.exe"
        strEXEFileName = """" & App_Path & "\test" & """"
        strCPPFonteName = """" & App_Path & "\test.cpp" & """"

strCompilerName & "-o " & strEXEFileName & " " & strCPPFonteName & " -static"

how i know that works???
the compiler compiles and i tested the exe in other folder and works. but the exe have 1,24MB's for tell "oi" and waiting that i press enter lol
thanks to all thanks
(these is my 1st topic in these forum: is there any tool for tell that these topic is resolved? and can i give you 'points'(rate you)?
thansk for all