www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [GtkD] Error 1: Previous Definition Different : __Dmain

reply "Adrien =?UTF-8?B?VMOpdGFyIg==?= <adri-from-59 hotmail.fr> writes:
Hi,

I have compiled GtkD 2.0 on Windows. Source files are passed to 
the compiler as well as library to the linker.
I followed instructions from here : 
https://github.com/gtkd-developers/GtkD/wiki/Installing-on-Windows

But there is an error appearing when GtkD.lib is passed to the 
linker:
Error 1: Previous Definition Different : __Dmain

This is supposed to mean that there are two main function in the 
code, but how do I fix it ?

Thanks in advance.

PS: I use DMD 2.060.
Oct 27 2012
next sibling parent reply Mike Wey <mike-wey example.com> writes:
On 10/27/2012 05:33 PM, "Adrien Tétar" <adri-from-59 hotmail.fr>" wrote:
 Hi,

 I have compiled GtkD 2.0 on Windows. Source files are passed to the
 compiler as well as library to the linker.
 I followed instructions from here :
 https://github.com/gtkd-developers/GtkD/wiki/Installing-on-Windows

 But there is an error appearing when GtkD.lib is passed to the linker:
 Error 1: Previous Definition Different : __Dmain

 This is supposed to mean that there are two main function in the code,
 but how do I fix it ?

 Thanks in advance.

 PS: I use DMD 2.060.

Did you already check if your code doesn't actually defines main twice? -- Mike Wey
Oct 27 2012
parent Mike Wey <mike-wey example.com> writes:
On 10/27/2012 10:18 PM, "Adrien Tétar" <adri-from-59 hotmail.fr>" wrote:
 On Saturday, 27 October 2012 at 20:02:16 UTC, Mike Wey wrote:
 Did you already check if your code doesn't actually defines main twice?

I don't think so... here's the code: module primary; import gtk.Main; void main(string[] args) { Main.init(args); Main.run(); } Thanks for your help.

Did you run the dgen executable from the src directory, otherwise it might be possible that some of the demos got compiled into the library. -- Mike Wey
Oct 28 2012
prev sibling next sibling parent "Adrien =?UTF-8?B?VMOpdGFyIg==?= <adri-from-59 hotmail.fr> writes:
On Saturday, 27 October 2012 at 20:02:16 UTC, Mike Wey wrote:
 Did you already check if your code doesn't actually defines 
 main twice?

I don't think so... here's the code: module primary; import gtk.Main; void main(string[] args) { Main.init(args); Main.run(); } Thanks for your help.
Oct 27 2012
prev sibling next sibling parent "Adrien =?UTF-8?B?VMOpdGFyIg==?= <adri-from-59 hotmail.fr> writes:
On Sunday, 28 October 2012 at 16:10:25 UTC, Mike Wey wrote:
 Did you run the dgen executable from the src directory, 
 otherwise it might be possible that some of the demos got 
 compiled into the library.

Yea I did. [IMG]http://www.abload.de/img/dgenrnk9j.png[/IMG] I even tried to remove the 'demos' folder but the compiled lib is of the same size... Maybe that happens because I use Eclipse + DDT? Here is my sc.ini : [Version] version=7.51 Build 020 [Environment] LIB="% P%\..\lib";\dm\lib DFLAGS="-I% P%\..\..\src\phobos" "-I% P%\..\..\src\druntime\import" "-I% P%\..\..\src\gtkd" "-L C:\D\dmd2\windows\lib\GtkD.lib" LINKCMD=% P%\link.exe
Oct 28 2012
prev sibling next sibling parent "Robik" <szadows gmail.com> writes:
On Sunday, 28 October 2012 at 18:15:14 UTC, Adrien Tétar wrote:
 On Sunday, 28 October 2012 at 16:10:25 UTC, Mike Wey wrote:
 Did you run the dgen executable from the src directory, 
 otherwise it might be possible that some of the demos got 
 compiled into the library.

Yea I did. [IMG]http://www.abload.de/img/dgenrnk9j.png[/IMG] I even tried to remove the 'demos' folder but the compiled lib is of the same size... Maybe that happens because I use Eclipse + DDT? Here is my sc.ini : [Version] version=7.51 Build 020 [Environment] LIB="% P%\..\lib";\dm\lib DFLAGS="-I% P%\..\..\src\phobos" "-I% P%\..\..\src\druntime\import" "-I% P%\..\..\src\gtkd" "-L C:\D\dmd2\windows\lib\GtkD.lib" LINKCMD=% P%\link.exe

Try removing dgen.d from there :)
Oct 28 2012
prev sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 10/27/2012 8:33 AM, "Adrien Tétar" <adri-from-59 hotmail.fr>" wrote:> But 
there is an error appearing when GtkD.lib is passed to the linker:
 Error 1: Previous Definition Different : __Dmain

 This is supposed to mean that there are two main function in the code,

http://www.digitalmars.com/ctg/OptlinkErrorMessages.html#previous_definition_different
 but how do I fix it ?

Try this: grep _Dmain gtkd.lib and see if it is in there.
Oct 28 2012