User forums > Using Code::Blocks

codeblocks+qt 4.2.1

(1/3) > >>

NGF:
Good evening.

I have codeblocks 1rc2 installed on windows xp home and qt 4.2.1 opensource installed too. I am trying to write a simple application using qt forms but I don't know how to do that. I tried the "QT Application" inside codeblocks but when I try to run it by pressing F9 it says:


--- Code: ---main.cpp:1:21: qstring.h: No such file or directory
main.cpp:2:26: qapplication.h: No such file or directory
main.cpp:3:25: qpushbutton.h: No such file or directory
main.cpp: In function `int main(int, char**)':
main.cpp:7: error: `QApplication' undeclared (first use this function)
main.cpp:7: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:7: error: expected `;' before "app"
main.cpp:8: error: `QPushButton' undeclared (first use this function)
main.cpp:8: error: expected `;' before "quit"
main.cpp:10: error: `quit' undeclared (first use this function)
main.cpp:11: error: `QFont' has not been declared
main.cpp:11: error: `Bold' undeclared (first use this function)
main.cpp:11: error: `QFont' undeclared (first use this function)
main.cpp:12: error: `QObject' has not been declared
main.cpp:12: error: `clicked' undeclared (first use this function)
main.cpp:12: error: `SIGNAL' undeclared (first use this function)
main.cpp:12: error: `app' undeclared (first use this function)
main.cpp:12: error: `SLOT' undeclared (first use this function)
main.cpp:12: error: `connect' undeclared (first use this function)

--- End code ---

the generated code is


--- Code: ---#include <qstring.h>
#include <qapplication.h>
#include <qpushbutton.h>

int main(int argc, char **argv)
{
    QApplication    app(argc, argv);
    QPushButton     quit("Hello World!");
   
    quit.resize(300, 40);
    quit.setFont(QFont("Arial", 18, QFont::Bold));
    QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));
    quit.show();
   
    return app.exec();
}

--- End code ---

Can you help me to set up QT? I don't like win api!

sethjackson:
Yup upgrade to a nightly build. ;)

Also your includes are wrong. Take the .h off.

iw2nhl:
As far as I know in Qt 4 the includes must be in one of the forms like:
#include <QApplication>
or
#include <qapplication.h>
While in Qt 3 only the last form is accepted.

May be you don't have the qt path correctly set?

NGF:
I tried taking off ".h" but no solution. Could you tell me more about setting qt path correctly? I am beginner to codeblocks and to C++. I am going to try nightly build.

NGF:
I tried nightly build. I started a new QT project and in the wizard I selected the qt folder with the lib and include subfolders. I tried to run the project and I got a error saying that cannot find QtCore4.dll file. When I press I get a dos window saying

Process returned -1073741515 (0xC0000135)   execution time : 2.938 s
Press any key to continue.

Any solutions???

Thank you in advance!!
Good night

Navigation

[0] Message Index

[#] Next page

Go to full version