Qmake build and gcc includes - qt

I am working with Qt and kinda new to it. I want to build a Qt application and created devprog.pro file. However, after executing qmake and make I get the error
c:\qt473\include\qtcore../../src/corelib/global/qglobal.h(45)
: fatal error C10 83: Cannot open
include file: 'stddef.h': No such file
or directory
So I specified the gcc 4.4.1 include location and the error messages (amongst others) I get is:
c:\codeblocks\MinGW\lib\gcc\mingw32\4.4.1\include\stddef.h(211)
: error C2371: ' size_t' :
redefinition; different basic types
predefined C++ types (compiler internal)(19) : see declaration of
'size_ t'
C:\CodeBlocks\MinGW\include\string.h(126)
: error C2143: syntax error : missing
';' before '*'
C:\CodeBlocks\MinGW\include\string.h(126)
: error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
My question is:
1. How can resolve such error problems as I've scratched my hair off trying to solve this.
2. Is there a way to make automatically let qmake detect your main gcc mingw location without having to set it for each project during qmake execution?

Related

GLEW and Qt5 redefinition of headers

So,
After upgrading our prject to Qt5 we are experiencing issues with glew. The app links a library that needs glew to work, and that works fine when using the library in non Qt apps.
Now though we are linking the library into a qt app and rendering into a glwidget. This used to work but now it doesnt. We get a huge array of errors that mostly say "redefinition of" something. Here's some examples:
1>c:\glew-1.9.0\include\gl\glew.h(275): error C2371: 'GLdouble' : redefinition; different basic types
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\qtgui\qopengl.h(71) : see declaration of 'GLdouble'
1>c:\glew-1.9.0\include\gl\glew.h(630): warning C4005: 'GL_DOUBLE' : macro redefinition
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\qtgui\qopengl.h(68) : see previous definition of 'GL_DOUBLE'
1>c:\glew-1.9.0\include\gl\glew.h(1655): error C2371: 'GLintptr' : redefinition; different basic types
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\gles2\gl2.h(38) : see declaration of 'GLintptr'
1>c:\glew-1.9.0\include\gl\glew.h(1656): error C2371: 'GLsizeiptr' : redefinition; different basic types
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\gles2\gl2.h(39) : see declaration of 'GLsizeiptr'
1>c:\glew-1.9.0\include\gl\glew.h(1707): warning C4005: 'GL_BLEND_EQUATION_RGB' : macro redefinition
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\gles2\gl2.h(96) : see previous definition of 'GL_BLEND_EQUATION_RGB'
1>c:\glew-1.9.0\include\gl\glew.h(11533): warning C4005: 'GL_COVERAGE_SAMPLES_NV' : macro redefinition
You get the idea. Anyway how can I stop Qt including its gl stuff so glew can work by itself?
As you can see gles is being a problem, so I was directed to use this:
#define QT_NO_OPENGL_ES_2
But this has no effect at all. There are other errors that don't reference gles like these:
1>c:\glew-1.9.0\include\gl\glew.h(275): error C2371: 'GLdouble' : redefinition; different basic types
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\qtgui\qopengl.h(71) : see declaration of 'GLdouble'
1>c:\glew-1.9.0\include\gl\glew.h(630): warning C4005: 'GL_DOUBLE' : macro redefinition
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\qtgui\qopengl.h(68) : see previous definition of 'GL_DOUBLE'
1>c:\glew-1.9.0\include\gl\glew.h(1655): error C2371: 'GLintptr' : redefinition; different basic types
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\gles2\gl2.h(38) : see declaration of 'GLintptr'
1>c:\glew-1.9.0\include\gl\glew.h(1656): error C2371: 'GLsizeiptr' : redefinition; different basic types
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\gles2\gl2.h(39) : see declaration of 'GLsizeiptr'
1>c:\glew-1.9.0\include\gl\glew.h(1707): warning C4005: 'GL_BLEND_EQUATION_RGB' : macro redefinition
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\gles2\gl2.h(96) : see previous definition of 'GL_BLEND_EQUATION_RGB'
1>c:\glew-1.9.0\include\gl\glew.h(11533): warning C4005: 'GL_COVERAGE_SAMPLES_NV' : macro redefinition
1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\qtgui\qopengles2ext.h(530) : see previous definition of 'GL_COVERAGE_SAMPLES_NV'
Hopefully you can help!
My personal approach with using OpenGL with Qt is to separate all OpenGL related part from Qt class implementation. In the Qt part I then just call into the framework neutral written OpenGL code through regular C or C++ interfaces using standard types. Since the actual OpenGL code makes no references to Qt then, it doesn't have to include Qt headers, avoiding problems like yours.
After a day of screwing around I have a solution!
In order to be cross platform Qt seems to have set OpenGLES to a high priority than desktop openGL.
THe solution to this is to build Qt from source code suing the setting -opengl desktop before you build. Something like this:
configure -debug-and-release -opengl desktop
Then use nmake to build and it works fine!

OpenGL+ QT 5.0.1 + VS2010: error C2371: 'GLdouble' : redefinition; different basic types

I have installed QT5.0.1 and I am trying to use GLUT.
I have the following error:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\GL/gl.h(55): error C2371: 'GLdouble' : redefinition; different basic types
1> C:\Qt\Qt5.0.1\5.0.1\msvc2010\include\QtGui/qopengl.h(71) : see declaration of 'GLdouble'
I cant understand what can be wrong and what to do.
I have installed QT5.0.1 and I am trying to use GLUT
Pick one and only one framework.
Trying to use Qt and GLUT at the same time will only result in problems because they both want to own the event loop.

Build error - variable environment not set correctly

I'm trying to build an opensource code on windows.
I get the error:
Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as D;/Qt/4.8.4/lib
Warning: D**;**/Qt/4.8.4/lib does NOT exist, Qt must NOT be installed correctly.
CMake Error at /usr/share/cmake-2.6.4/Modules/FindQt4.cmake:640 (MESSAGE):
Could NOT find QtCore header
(this is only a part of the error message)
I tried to re-install Qt, didn't work.
I tried to change QT_INSTALL_LIBS to be D:/Qt/4.8.4/lib (and not D:/Qt/4.8.4/lib) in my computer -> properties -> advanced - > environment variables but that didn't seem to change a thing.
I have no idea what to do next. Does anyone know what I should do fix it?

Qt: Building quazip/zlib Library error

I am statically building the quazip library as mentioned in the following post: linking QuaZip with Qt 4.8.0 into project
I get these error when I build the project:
/QtSDK/QtSources/4.8.0/src/3rdparty/zlib/zconf.h:373:6: error: "_LARGEFILE64_SOURCE" is not defined
In file included from ../../../quazip-0.4.4/quazip/zip.h:56,
from ../../../quazip-0.4.4/quazip/quazip.h:31,
from ../../../quazip-0.4.4/quazip/quazipfile.h:30,
from ../../../quazip-0.4.4/quazip/quazipfile.cpp:24:
/QtSDK/QtSources/4.8.0/src/3rdparty/zlib/zlib.h:1583:32: error: "_FILE_OFFSET_BITS" is not defined
cc1plus: warnings being treated as errors
Are these known errors in zlib library? I am using zlib library in Qt 4.8.0
That would be a bug in your compiler. I can't tell what version of zlib you're using, and your compiler does not show the offending line in the error message, so I can't tell exactly what the line contains. However I suspect that these are lines that have an #if directive with the noted symbol in the expression. Per the C standard, a symbol that is not defined is given a null value (no characters replace it) in an expression in an #if statement. Instead your compiler is erroneously issuing an error.

Problem statically linking to Botan on Windows using MSVC

I am trying to statically link a Qt library I am building to Botan using MSVC on Windows and am receiving the following error.
..\..\3rdparty\temp\botan-msvc\build\include\botan/secmem.h(129) : error C2589: '(' : illegal token on right side of '::'
..\..\3rdparty\temp\botan-msvc\build\include\botan/secmem.h(128) : while compiling class template member function 'void Botan::MemoryRegion<T>::copy(const T [],size_t)'
with
[
T=Botan::byte
]
..\..\3rdparty\temp\botan-msvc\build\include\botan/buf_comp.h(41) : see reference to class template instantiation 'Botan::MemoryRegion<T>' being compiled
with
[
T=Botan::byte
]
..\..\3rdparty\temp\botan-msvc\build\include\botan/secmem.h(129) : error C2059: syntax error : '::'
This does not occur with MinGW. It also occurs when I comment out all Botan-related code. What does this mean and how can I solve it - also why does it not occur with MinGW?
I was able to figure out the issue with help from Jack Lloyd's comment. Apparently something that's included through one path or another #defined "min". I just undefined it and my library compiles and links perfectly. Thanks Jack!

Resources