Author Topic: Problem including header files in codeblocks QT4 Windows xp [Screenies Posted]  (Read 7888 times)

Offline adityagameprogrammer

  • Single posting newcomer
  • *
  • Posts: 8
Hi,
      I have recently started using the code blocks IDE and have found it to be absolutely amazing. I am to work on QT on windows xp . so have set up the environment.  I am having trouble configuring the include files
« Last Edit: February 23, 2011, 11:24:14 am by adityagameprogrammer »

Offline adityagameprogrammer

  • Single posting newcomer
  • *
  • Posts: 8
Re: Build/Run QT4 examples using codeblocks on windows xp[set up correctly]
« Reply #1 on: February 23, 2011, 08:45:57 am »
A major part of the problem as i understand is not configuring the library paths properly....
Code
#include <QApplication>
#include <QFont>
#include <QPushButton>

/*
// The Libraries wont open..
#include <QReadWriteLock>
#include <QWaitCondition>
#include <QStringList> // also for QString & QList
#include <QThread>
#include <QMutex>
#include <QDate>
#include <QSize>
#include <QPair>
#include <QMap>
#include <QSet>
*/

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

    QPushButton quit("Quit");

    quit.resize(75, 30);
    quit.setFont(QFont("Times", 18, QFont::Bold));

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

    return app.exec();
}
This  program runs when there are only the default 3 libraries. 
the libraries are  present in
Quote
C:\Qt\2010.05\qt\include\QtCore
C:\Qt\2010.05\qt\include\Qt
C:\Qt\2010.05\qt\include\QtGui
How do i set these libraries in the project....

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Build/Run QT4 examples using codeblocks on windows xp[set up correctly]
« Reply #2 on: February 23, 2011, 09:55:52 am »
Project -> Build options -> Search Dirs -> Include for the include paths
Project -> Build options -> Search Dirs -> Libs for the libs paths

Take a look at the global variables, they are made for such things/setups
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline adityagameprogrammer

  • Single posting newcomer
  • *
  • Posts: 8
Re: Build/Run QT4 examples using codeblocks on windows xp[set up correctly]
« Reply #3 on: February 23, 2011, 10:13:51 am »
I have done the same but the problem persists. I even tried  clicking on the header file and trying to open it through code blocks. but i get an error stating that the file is not found.  I have taken screen shots of the linker settings , search directories, global variables and the error. kindly let me know what i seem to be  missing.
linker settings

search directory settings

global variable settings

header file open error

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

And post pasted logs, not screen shots (using code tags).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline adityagameprogrammer

  • Single posting newcomer
  • *
  • Posts: 8
some how enabling the "Full command line" option in compiler logging seems to have .. worked a bit.
the build log is as below
Code
Build started on: 23-02-2011 at 15:27.44
Build ended on: 23-02-2011 at 15:27.46
-------------- Build: Debug in qt_test ---------------
mingw32-g++.exe -Wall -g
-IC:\Qt\2010.05\qt\include
-IC:\Qt\2010.05\qt\include\QtGui
-IC:\Qt\2010.05\qt\include\QtCore
-IC:\Qt\2010.05\qt\include\Qt
-IC:\Qt\2010.05\qt\include\QtCore
-IC:\Qt\2010.05\qt\include\Qt
-IC:\Qt\2010.05\qt\include\QtGui
-c D:\Aditya\CodeBlocks\qt_test\main.cpp -o obj\Debug\main.o mingw32-g++.exe
-LC:\Qt\2010.05\qt\lib -o bin\Debug\qt_test.exe obj\Debug\main.o -lQtCore4 -lQtGui4
Output size is 180.75 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
But i get a couple of redirection in between when i try to open a header file. in the sense it wont open directly but opens 2 in between files to finally get to the header file..
Code
#include <QThread> 
a file QThread opens up containing
Code
#include "qthread.h" 
and i click qthread.h again here i get a file qthread.h opening up
containing
Code
#include "../../src/corelib/thread/qthread.h" 
finally clicking qthread.h here opens up the required header file
Code
#ifndef QTHREAD_H
#define QTHREAD_H

#include <QtCore/qobject.h>

#include <limits.h>

QT_BEGIN_HEADER
// .......


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
But i get a couple of redirection in between when i try to open a header file. in the sense it wont open directly but opens 2 in between files to finally get to the header file..
This is QT thing, no C::B problem...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline adityagameprogrammer

  • Single posting newcomer
  • *
  • Posts: 8
Thanks

is that the way it usually works? I had assumed it is to do with again with linking .. or some setting in C::B.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
It depends on the way the library is build and structured.
The QT guys have their reasons to use 3 headers ...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]