Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: bfr on May 12, 2007, 07:07:44 pm

Title: Using Qt and SDL
Post by: bfr on May 12, 2007, 07:07:44 pm
How would I use Qt and SDL together?  I can't choose two templates at once...can I?

EDIT:  And when I added C:/sdl/SDL-1.2.11/include/ and C:/sdl/SDL-1.2.11/lib/ (which should be the correct locations) to the "Search Directories" in the apporpriate places, I get:

C:\MinGW\lib\libmingw32.a(main.o):main.c:(.text+0x106):: undefined reference to `WinMain@16'
:: === Build finished: 1 errors, 0 warnings ===

I'm using the May 12 Nightly version of Code::Blocks.  Here is my code:

Code
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include "SDL.h"

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    QPushButton quit("Quit");

    quit.resize(500, 400);
    quit.setFont(QFont("Times", 18, QFont::Bold));

    QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));

    quit.show();
    return app.exec();
}

EDIT AGAIN:  Also, what does Code::Blocks do when a Qt or SDL template is selected?  Does it just add SDL or Qt directories to the Compiler and Linker tabs in "Search Directories" in the "Build Options"?

ANOTHER EDIT:  I got it to work!!!!  I had to edit some linker settings.
Title: Re: Using Qt and SDL
Post by: raph on May 13, 2007, 11:06:41 am
EDIT AGAIN:  Also, what does Code::Blocks do when a Qt or SDL template is selected?  Does it just add SDL or Qt directories to the Compiler and Linker tabs in "Search Directories" in the "Build Options"?
That's right, a wizard adjusts the compiler and linker settings to fit the project-type requirements and creates an example sourcecode.

Regards
raph