Qt-interest Archive, November 2003
Compiling QT/SDL program
Message 1 in thread
Hi all,
I try (again) to compile a program using QT and SDL.
I get the following error:
SDLmain.lib(SDL_main.obj) : error LNK2005: _WinMain@16 already defined in qtmain.lib(qtmain_win.obj)
Debug/QtSDLVideo.exe : fatal error LNK1169: one or more multiply defined symbols found
It looks like the main() is declared in both QT and SLD libraries. Could anybody get around this problem?
Yann Le Page,
Chargé d'affaires
CYBERNETIX- S.A.
306 Rue A. Einstein, BP94 - 13382 MARSEILLE Cedex 13 - FRANCE
Phone : +33 (0)4 91 21 77 00 - Fax : +33 (0)4 91 21 77 01
Email : yann.lepage@cybernetix.fr
Message 2 in thread
On November 5, 2003 09:03 am, LE PAGE Yann wrote:
> Hi all,
> I try (again) to compile a program using QT and SDL.
> I get the following error:
> SDLmain.lib(SDL_main.obj) : error LNK2005: _WinMain@16 already defined in
> qtmain.lib(qtmain_win.obj) Debug/QtSDLVideo.exe : fatal error LNK1169: one
> or more multiply defined symbols found
>
> It looks like the main() is declared in both QT and SLD libraries. Could
> anybody get around this problem?
There's a large amount of information on this in the archives. It certainly
looks quite easy to do.
Message 3 in thread
chris@hypocrite.org wrote:
> On November 5, 2003 09:03 am, LE PAGE Yann wrote:
>
>> Hi all, I try (again) to compile a program using QT and SDL. I get
>> the following error: SDLmain.lib(SDL_main.obj) : error LNK2005:
>> _WinMain@16 already defined in qtmain.lib(qtmain_win.obj)
>> Debug/QtSDLVideo.exe : fatal error LNK1169: one or more multiply
>> defined symbols found
>>
>> It looks like the main() is declared in both QT and SLD libraries.
>> Could anybody get around this problem?
>
>
> There's a large amount of information on this in the archives. It
> certainly looks quite easy to do.
>
Maybe so. When I was trying, I didn't link SDLmain.lib. However, in
general, the embedding of SDL in a Qt Widget on MS Windows seems to be a
thorny task. I was unable to find a single instance in the archive of
either the Qt or SDL mailing lists of anyone who'd achieved it successfully.
I eventually gave up and started using DirectX int a Qt Widget on
Windows instead. (Yann I sent you a code snippet a while back - did it
not work for you?)
Of course, if you have achieved it successfully, or can find a post (and
code example!) of anyone who has, I, Yann, and no doubt several others
will be grateful!
Owen
Message 4 in thread
Ok, It works, but I removed $(QTDIR)\lib\qtmain.lib from the linker.
Is qtmain.lib mandatory? what does it contain in addition to $(QTDIR)\lib\qt-mt320.lib ?
-----Original Message-----
From: LE PAGE Yann
Sent: Wednesday, November 05, 2003 5:04 PM
To: qt-interest@trolltech.com
Subject: Compiling QT/SDL program
Hi all,
I try (again) to compile a program using QT and SDL.
I get the following error:
SDLmain.lib(SDL_main.obj) : error LNK2005: _WinMain@16 already defined in qtmain.lib(qtmain_win.obj)
Debug/QtSDLVideo.exe : fatal error LNK1169: one or more multiply defined symbols found
It looks like the main() is declared in both QT and SLD libraries. Could anybody get around this problem?
Yann Le Page,
Chargé d'affaires
CYBERNETIX- S.A.
306 Rue A. Einstein, BP94 - 13382 MARSEILLE Cedex 13 - FRANCE
Phone : +33 (0)4 91 21 77 00 - Fax : +33 (0)4 91 21 77 01
Email : yann.lepage@cybernetix.fr
--
[ signature omitted ]
Message 5 in thread
hi,
> Ok, It works, but I removed $(QTDIR)\lib\qtmain.lib from the linker.
> Is qtmain.lib mandatory? what does it contain in addition to $(QTDIR)\lib\qt-mt320.lib ?
on windows (which you seem to be using), it essentially calls qWinMain()
and main(). i haven't looked into what qWinMain does exactly. however,
you might want to make sure these calls occur in your program to prevent
missing initialisation problems.
have a look at QTDIR/src/kernel/qtmain*.cpp for further informations.
-- Matthias
______________________________________________________________________
Matthias Fritschi
mfritschi[at]netlabs.org
Message 6 in thread
Are you compiling on Linux or Win32?
I get the problem on win32: I still can't link qtmain.obj and SDLmain.obj in the same project...
I could get it to work with qtmain.obj removed, but now, I get an error as soon as I move the mose on top of the widget.
I'm at this point: The SDL display is built on top of a QFrame by doing the following, but It crashes when I use it...:
int main( int argc, char* argv[] )
{
SDL_Surface *screen;
QApplication app( argc, argv );
QtSDLVideoDialog dialog( 0, 0, TRUE );
app.setMainWidget(&dialog);
qDebug("initialize SDL: \n");
dialog.show();
dialog.update();
QString windowid="SDL_WINDOWID="+QString::number((long int)(dialog.frameVideo->winId())); //.frameVideo
_putenv(windowid.latin1());
_putenv("SDL_VIDEODRIVER=windib");
ShowWindow((dialog.frameVideo->winId()), SW_SHOWNOACTIVATE);
UpdateWindow((dialog.frameVideo->winId()));
/* This makes sure that the SDL window get all of his events */
SetFocus((dialog.frameVideo->winId()));
screen=SDL_SetVideoMode(640, 480, 24, SDL_SWSURFACE); //SDL_HWSURFACE|SDL_NOFRAME|SDL_DOUBLEBUF);
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
qDebug(QString("Couldn't initialize SDL: %1").arg(SDL_GetError()));
exit(1);
}
/* Set a video mode */
dialog.exec();
SDL_Quit();
return 0;
}
-----Original Message-----
From: Owen Brydon [mailto:owen.brydon@st.com]
Sent: Thursday, November 06, 2003 5:16 PM
To: qt-interest@trolltech.com
Subject: Re: Compiling QT/SDL program
chris@hypocrite.org wrote:
> On November 5, 2003 09:03 am, LE PAGE Yann wrote:
>
>> Hi all, I try (again) to compile a program using QT and SDL. I get
>> the following error: SDLmain.lib(SDL_main.obj) : error LNK2005:
>> _WinMain@16 already defined in qtmain.lib(qtmain_win.obj)
>> Debug/QtSDLVideo.exe : fatal error LNK1169: one or more multiply
>> defined symbols found
>>
>> It looks like the main() is declared in both QT and SLD libraries.
>> Could anybody get around this problem?
>
>
> There's a large amount of information on this in the archives. It
> certainly looks quite easy to do.
>
Maybe so. When I was trying, I didn't link SDLmain.lib. However, in
general, the embedding of SDL in a Qt Widget on MS Windows seems to be a
thorny task. I was unable to find a single instance in the archive of
either the Qt or SDL mailing lists of anyone who'd achieved it successfully.
I eventually gave up and started using DirectX int a Qt Widget on
Windows instead. (Yann I sent you a code snippet a while back - did it
not work for you?)
Of course, if you have achieved it successfully, or can find a post (and
code example!) of anyone who has, I, Yann, and no doubt several others
will be grateful!
Owen
--
[ signature omitted ]
Message 7 in thread
Hi Owen,
Yes, I could compile your code and used it, but it's getting really complicated, and I would really like to do it with SDL instead.
I'm not too far from the solution (I have the SDL window shown on top of a widget), I still have a crash when redimensionning and/or moving the mouse on top of it, but I'm sure we're close !
Yann
-----Original Message-----
From: Owen Brydon [mailto:owen.brydon@st.com]
Sent: Thursday, November 06, 2003 5:16 PM
To: qt-interest@trolltech.com
Subject: Re: Compiling QT/SDL program
chris@hypocrite.org wrote:
> On November 5, 2003 09:03 am, LE PAGE Yann wrote:
>
>> Hi all, I try (again) to compile a program using QT and SDL. I get
>> the following error: SDLmain.lib(SDL_main.obj) : error LNK2005:
>> _WinMain@16 already defined in qtmain.lib(qtmain_win.obj)
>> Debug/QtSDLVideo.exe : fatal error LNK1169: one or more multiply
>> defined symbols found
>>
>> It looks like the main() is declared in both QT and SLD libraries.
>> Could anybody get around this problem?
>
>
> There's a large amount of information on this in the archives. It
> certainly looks quite easy to do.
>
Maybe so. When I was trying, I didn't link SDLmain.lib. However, in
general, the embedding of SDL in a Qt Widget on MS Windows seems to be a
thorny task. I was unable to find a single instance in the archive of
either the Qt or SDL mailing lists of anyone who'd achieved it successfully.
I eventually gave up and started using DirectX int a Qt Widget on
Windows instead. (Yann I sent you a code snippet a while back - did it
not work for you?)
Of course, if you have achieved it successfully, or can find a post (and
code example!) of anyone who has, I, Yann, and no doubt several others
will be grateful!
Owen
--
[ signature omitted ]
Message 8 in thread
Yann.lepage@cybernetix.fr wrote:
> Hi Owen,
> Yes, I could compile your code and used it, but it's getting really complicated, and I would really like to do it with SDL instead.
> I'm not too far from the solution (I have the SDL window shown on top of a widget), I still have a crash when redimensionning and/or moving the mouse on top of it, but I'm sure we're close !
> Yann
>
Hi Yann,
If you get this sorted out eventually, Qt/SDL users everywhere would be
helped if you posted an example.
Let us know how you get on - good luck!
Owen