View mode: basic / threaded / horizontal-split · Log in · Help
October 27, 2012
[GtkD] Error 1: Previous Definition Different : __Dmain
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.
October 27, 2012
Re: [GtkD] Error 1: Previous Definition Different : __Dmain
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
October 27, 2012
Re: [GtkD] Error 1: Previous Definition Different : __Dmain
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.
October 28, 2012
Re: [GtkD] Error 1: Previous Definition Different : __Dmain
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
October 28, 2012
Re: [GtkD] Error 1: Previous Definition Different : __Dmain
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
October 28, 2012
Re: [GtkD] Error 1: Previous Definition Different : __Dmain
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 :)
October 28, 2012
Re: [GtkD] Error 1: Previous Definition Different : __Dmain
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.
Top | Discussion index | About this forum | D home