Author Topic: (REsolved!) Qt headers can not be found  (Read 21171 times)

Offline onesteplower

  • Multiple posting newcomer
  • *
  • Posts: 12
(REsolved!) Qt headers can not be found
« on: September 22, 2013, 09:58:00 am »
UPDATE: I just found that Code::Blocks is not recursively searching the search directories, so to have access to the full Qt library I will need to add every single folder containing header files one by one...  Unless I can find a better option.  If there's a way to specify the top-level directory to search and have Code::Blocks check all subdirectories, please let me know!  ... Can't believe it took me a day to think of that...

Update 2: Right click project --> "Add Files Recursively" --> ...\include --> (wait) --> others --> "Remove files"  (last edit: Don't remove the "other" files.  Qt doesn't add .h to all of its headers...)

Qt headers are under headers\Qt.  Now I can open one of them to get its appropriate path and just include it that way.  I don't know if it's the right way unless the right way is any way that works, but I have access to the whole library for learning purposes.  When I'm done with this project, I can add the search directories to include on the ones it needs.  


The above won't work due to includes in Qt's files (DUH... I'm sleep-deprived shaddup lol).  So, without completely rewriting all of Qt's includes, it looks like it's impossible to use it in Code::Blocks.


.................

I am running Code::Blocks version 12.11 on Windows 8 64-bit
(6.2 build 9200). The compiler I use is GCC 4.8.1 and Microsoft Visual C++ 2010 16.00.40219.01 for 80x86

I followed all steps, in appropriate order, as listed on the Qt site for installing Qt and programming with it, (edit: *with the intent of doing so*) in Code::Blocks.  When I try to include any headers from Qt, I get a message that they can not be found.

Build log:
Code
Build started on: 22-09-2013 at 02:06.35
Build ended on: 22-09-2013 at 02:06.36
-------------- Build: Debug in Kerbal Analysis (compiler: Microsoft Visual C++ 2010)---------------
cl.exe /nologo /W3 /EHsc /MDd /Zi /D_DEBUG /I"..\..\Program Files\Microsoft SDKs\Windows\v7.1\Include" /I"D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" /ID:\Qt\Qt5.1.1\5.1.1\msvc2010_opengl\lib\cmake\Qt5Widgets /c main.cpp /Foobj\Debug\main.obj
main.cpp
d:\cb projects\kerbal analysis\winMate.h(201) : warning C4355: 'this' : used in base member initializer list
main.cpp(2) : fatal error C1083: Cannot open include file: 'Qt5Gui': Invalid argument
Process terminated with status 2 (0 minutes, 0 seconds)
1 errors, 1 warnings (0 minutes, 0 seconds)

The same result occurs with GCC using mingw via the following command:

D:\mingw32\bin\mingw32-g++.exe -Wall -g -I D:\Qt\Qt5.1.1\5.1.1\mingw48_32\include -I D:\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtGui -I D:\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtWidgets -c "D:\CB Projects\testqt\main.cpp" -o obj\Debug\main.o

I have already tried...

1. Verifying the installation process by backtracking through each step and checking notes to be sure that I did everything in the proper sequence previously.

2. Attempting to compile from within Qt Creator, with success.

3. Attempting to compile from within Visual Studio, with the same problem.

4. Reinstalling everything except for the sequence of applications involved in the Direct X SDK, Visual Studio, and Windows SDK.  

5. Installing the Windows 2003 SP1 SDK that is specified (via broken link) on the Code::Blocks wiki.

6. Verifying all environmental variables again, in path, PATH, lib, LIB, include, and INCLUDE in every combination and permutation.

7. Adding all the Qt lib, bin, and include directories to the compiler and linker search directories each and both in every combination and permutation.

8. Compiling via command prompt as described above.

9. Reinstalling Qt.

10. Repeating steps 6 through 8, repairing a problem that popped up with MinGW along the way.

11. At each previous step whenever I tried to compile, I tried using both the bracket <> notation for headers and quotation mark "" notation, with and without the ".h" on the end in every combination.

(edit2) 12: Adding the QtWidgets folder to the search path...  I did this earlier, but forgot to add list it here.

(edit3) 13: I also tried this with two projects; my actual current project and a hello world project just for this, in case my project had a problem.

... but none of them worked.

edit3: Just in case anybody is curious, the "this" used in an initialization list warning is just a pointer to a derived class used to access a constructor in the parent class meant only for the derived class; this way all other signatures are free for future users to program with.  The pointer is never accessed, so there's no undefined behavior.
« Last Edit: September 22, 2013, 01:04:16 pm by onesteplower »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: (SOLVED!) Qt headers can not be found
« Reply #1 on: September 22, 2013, 12:20:58 pm »
The usual process of including a header file under some main '/include' folder is using its sub-path. For example say you have appended your include folder 'path_to_qt_installation/include' to your search folders for your compiler then to use header files you have to include them as
Code
#include <QtCore/qconfig.h>
Code
#include <QtCore/private/qfileinfo_p.h>
etc...
That's how they work.

Offline onesteplower

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: (UNsolved!) Qt headers can not be found
« Reply #2 on: September 22, 2013, 12:54:06 pm »
Thanks!  I'll try that.

The biggest thing that attracts me to Qt is that I've been told it is written in and can be worked with just like C++...  If this can work, then it will be my first real run at GUI/graphics (after many false starts)

edit:  Yes!  Now I'm getting errors from WITHIN the QtCode!  ... wait a minute.  Well, it's progress.  It included and didn't die in the next layer of includes.

Final edit (for real this time): Now I get to learn how to link libraries!  So, yep, this is progress. 
« Last Edit: September 22, 2013, 01:05:18 pm by onesteplower »