PDA

View Full Version : Working project failing to build



gpuckett
7th June 2015, 23:45
I am using Qt Creator to work on a project. Qt Creator is v3.1.2 based on Qt 5.3.1 (MSVC 2010, 32bit). After getting a significant part of the application coded and tested I was adding a couple of new modules. I started getting errors in Qt code!!! I have no idea what is causing it.

So I decided to start a new project and add the old code one module at a time. I have a global header file that I use to define various structures that are passed between modules. I have not changed this module at all. It has been working fine up to this point.

Here is the module:


#ifndef GLOBAL_H
#define GLOBAL_H

#include <QString>

struct _RoadsData {
QString state;
QString cnty;
QString name;
QString mtfcc;
QString rttype;
int roadtype;
QString geometry;
};

struct _ContourData {
QString state;
QString cnty;
int type;
QString geometry;
};

struct _ImperviousData {
QString state;
QString cnty;
int type;
QString geometry;
};

struct _AreaObjectsData {
QString state;
QString cnty;
int type;
QString name;
QString geometry;
};

struct _ParcelData {
QString state;
QString cnty;
QString address;
QString geometry;
};

struct _PointObjectsData {
QString state;
QString cnty;
int type;
QString name;
QString geometry;
};

struct _AddrPointData {
QString state;
QString cnty;
int stnbr;
QString geometry;
};


Q_DECLARE_METATYPE(_RoadsData)
Q_DECLARE_METATYPE(_ContourData)
Q_DECLARE_METATYPE(_ParcelData)
Q_DECLARE_METATYPE(_AddrPointData)
Q_DECLARE_METATYPE(_ImperviousData)
Q_DECLARE_METATYPE(_AreaObjectsData)
Q_DECLARE_METATYPE(_PointObjectsData)
#endif // GLOBAL_H
The project builds clean if I haven't yet used this file. As soon as I include it in a module I get the following error for each of the declares:


C3646: 'Q_DECLARE_METATYPE' : unknown override specifier

I also get
C2091: function returns function in global.h

Also I get a bunch of errors in iterator and xfunctional.

In searching this error I found a suggestion that I put in an include for QMetaType. (It worked fine before this without that include.) I put it in. The errors went away in global.h. But now I'm getting errors in iterator, qlist.h, qscopedpointer.h and qobject_impl.h.

I don't know what to do!!! Please help.

ChrisW67
8th June 2015, 07:19
What Qt version and Microsoft Visual C++ compiler version are you using to build your project? This is not the same thing as the compiler and Qt version used to build Qt Creator.

Do you have C++11 options in your PRO file? "override" is a C++11 specifier.

It would generally help if you published the entire compiler output providing context to the warning/error message.

The C++ specification reserves identifier names starting with an underscore and upper-case letter (or just an underscore in global scope, or two underscores anywhere in the identifier) for the compiler implementation. You are using these for your struct type names, and this may be causing an issue.
http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier

gpuckett
8th June 2015, 16:55
What Qt version and Microsoft Visual C++ compiler version are you using to build your project? This is not the same thing as the compiler and Qt version used to build Qt Creator.

Do you have C++11 options in your PRO file? "override" is a C++11 specifier.

It would generally help if you published the entire compiler output providing context to the warning/error message.

The C++ specification reserves identifier names starting with an underscore and upper-case letter (or just an underscore in global scope, or two underscores anywhere in the identifier) for the compiler implementation. You are using these for your struct type names, and this may be causing an issue.
http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier

I am using Microsoft Windows SDK for Windows 7(7.1.7600.0.30514)(x86) as the compiler. I have QT v5.3.1 32-bit installed.

I do not have C++11 activated. I tried turning it on a few weeks ago and received an error. (CONFIG += c++11)

I changed the struct names and still receive the same errors.

I have been using this configuration for over a year now and started the current project about 2 months ago. The code as listed above has compiled fine until late last week. All I did was add a new class to the project.

Added after 4 minutes:

The error output is too long to post in one reply. Here is part 1:


10:33:26: Running steps for project AddProcessing...
10:33:26: Starting: "C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\bin\qmake.exe" C:\Qt-Projects\CarmentaProjects\AddProcessing\AddProcess ing.pro -r -spec win32-msvc2010 "CONFIG+=debug"
10:33:27: The process "C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\bin\qmake.exe" exited normally.
10:33:27: Starting: "C:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe"
C:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\bin\uic.exe ..\..\..\Qt-Projects\CarmentaProjects\AddProcessing\mainwindow .ui -o ui_mainwindow.h
C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\bin\uic.exe ..\..\..\Qt-Projects\CarmentaProjects\AddProcessing\processpro jectinput.ui -o ui_processprojectinput.h
C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\bin\moc.exe -DUNICODE -DWIN32 -DQT_MULTIMEDIAWIDGETS_LIB -DQT_OPENGL_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1600 -D_WIN32 -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/mkspecs/win32-msvc2010 -IC:/Qt-Projects/CarmentaProjects/AddProcessing -IC:/Progra~2/Carmenta/Carmen~1/include -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtMultimediaWidgets -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtOpenGL -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtMultimedia -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtWidgets -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtSql -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtNetwork -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtGui -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtCore -I. ..\..\..\Qt-Projects\CarmentaProjects\AddProcessing\mainwindow .h -o debug\moc_mainwindow.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\AddProcessing.pdb -DUNICODE -DWIN32 -DQT_MULTIMEDIAWIDGETS_LIB -DQT_OPENGL_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"..\..\..\Progra~2\Carmenta\Carmen~1\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt MultimediaWidgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt OpenGL" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Multimedia" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Widgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Sql" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Network" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Gui" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Core" -I"debug" -I"." -I"." -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\mkspecs\wi n32-msvc2010" -Fodebug\ @C:\Users\GLENNP~1\AppData\Local\Temp\main.obj.621 6.16.jom
C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\bin\rcc.exe -name resources ..\..\..\Qt-Projects\CarmentaProjects\AddProcessing\resources. qrc -o debug\qrc_resources.cpp
main.cpp
C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\bin\moc.exe -DUNICODE -DWIN32 -DQT_MULTIMEDIAWIDGETS_LIB -DQT_OPENGL_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1600 -D_WIN32 -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/mkspecs/win32-msvc2010 -IC:/Qt-Projects/CarmentaProjects/AddProcessing -IC:/Progra~2/Carmenta/Carmen~1/include -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtMultimediaWidgets -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtOpenGL -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtMultimedia -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtWidgets -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtSql -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtNetwork -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtGui -IC:/Qt/Qt5.3.1/5.3/msvc2010_opengl/include/QtCore -I. ..\..\..\Qt-Projects\CarmentaProjects\AddProcessing\processpro jectinput.h -o debug\moc_processprojectinput.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\AddProcessing.pdb -DUNICODE -DWIN32 -DQT_MULTIMEDIAWIDGETS_LIB -DQT_OPENGL_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"..\..\..\Progra~2\Carmenta\Carmen~1\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt MultimediaWidgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt OpenGL" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Multimedia" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Widgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Sql" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Network" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Gui" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Core" -I"debug" -I"." -I"." -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\mkspecs\wi n32-msvc2010" -Fodebug\ @C:\Users\GLENNP~1\AppData\Local\Temp\processproje ctinput.obj.6216.78.jom
processprojectinput.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\AddProcessing.pdb -DUNICODE -DWIN32 -DQT_MULTIMEDIAWIDGETS_LIB -DQT_OPENGL_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"..\..\..\Progra~2\Carmenta\Carmen~1\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt MultimediaWidgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt OpenGL" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Multimedia" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Widgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Sql" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Network" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Gui" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Core" -I"debug" -I"." -I"." -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\mkspecs\wi n32-msvc2010" -Fodebug\ @C:\Users\GLENNP~1\AppData\Local\Temp\mainwindow.o bj.6216.250.jom
mainwindow.cpp
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\AddProcessing.pdb -DUNICODE -DWIN32 -DQT_MULTIMEDIAWIDGETS_LIB -DQT_OPENGL_LIB -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"..\..\..\Progra~2\Carmenta\Carmen~1\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt MultimediaWidgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt OpenGL" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Multimedia" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Widgets" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Sql" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Network" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Gui" -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\Qt Core" -I"debug" -I"." -I"." -I"..\..\..\Qt\Qt5.3.1\5.3\msvc2010_opengl\mkspecs\wi n32-msvc2010" -Fodebug\ @C:\Users\GLENNP~1\AppData\Local\Temp\qrc_resource s.obj.6216.328.jom
qrc_resources.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(61) : error C2143: syntax error : missing ';' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(61) : error C2059: syntax error : '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(61) : error C2065: '_Container' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(62) : error C2059: syntax error : 'public'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(203) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(204) : error C2238: unexpected token(s) preceding ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(205) : error C2059: syntax error : '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(206) : error C2238: unexpected token(s) preceding ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(207) : error C2059: syntax error : '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(208) : error C2238: unexpected token(s) preceding ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(210) : error C2143: syntax error : missing ';' before '&&'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(210) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
jom: C:\Qt-Testing\Carmenta\AddProcessing\Makefile.Debug [debug\processprojectinput.obj] Error 2

Error output Part 2:


C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(210) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(240) : error C2143: syntax error : missing ';' before '*'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(240) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(241) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(284) : error C2061: syntax error : identifier 'difference_type'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(285) : error C2805: binary 'operator +=' has too few parameters
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(285) : error C2333: 'Loadfiles::std::move_iterator<_RanIt>::operator +=' : error in function declaration; skipping function body
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(290) : error C2061: syntax error : identifier 'difference_type'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(295) : error C2061: syntax error : identifier 'difference_type'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(296) : error C2805: binary 'operator -=' has too few parameters
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(296) : error C2333: 'Loadfiles::std::move_iterator<_RanIt>::operator -=' : error in function declaration; skipping function body
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(301) : error C2061: syntax error : identifier 'difference_type'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(306) : error C2143: syntax error : missing ';' before '['
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(306) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(306) : error C2061: syntax error : identifier 'difference_type'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(307) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(307) : error C2805: binary 'operator [' has too few parameters
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(307) : error C2333: 'Loadfiles::std::move_iterator<_RanIt>::operator []' : error in function declaration; skipping function body
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(317) : error C2143: syntax error : missing ';' before '-'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(317) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(318) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(419) : error C2143: syntax error : missing ',' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(476) : see reference to class template instantiation 'Loadfiles::std::istream_iterator<_Ty,_Elem,_Traits,_Diff>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(426) : error C2143: syntax error : missing ';' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(426) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(426) : error C2238: unexpected token(s) preceding ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(433) : error C2061: syntax error : identifier 'istream_type'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(433) : error C2535: 'Loadfiles::std::istream_iterator<_Ty,_Elem,_Traits,_Diff>::istream_iterator(void)' : member function already defined or declared
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(428) : see declaration of 'Loadfiles::std::istream_iterator<_Ty,_Elem,_Traits,_Diff>::istream_iterator'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(474) : error C2143: syntax error : missing ';' before '*'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(474) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(474) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(521) : error C2143: syntax error : missing ';' before '<'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(555) : see reference to class template instantiation 'Loadfiles::std::ostream_iterator<_Ty,_Elem,_Traits>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(521) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(521) : error C2238: unexpected token(s) preceding ';'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(523) : error C2061: syntax error : identifier 'ostream_type'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(554) : error C2143: syntax error : missing ';' before '*'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(554) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\iterator(554) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I appologize for the posts. It keeps repeating every time I post. There is more to the output but I don't want to mess up this subject.

ChrisW67
8th June 2015, 23:10
The first error comes from trying to compile the generated C++ code for the embedded resources qrc_resources.cpp. This code should not contain any reference to any of your headers. If you have not done so already delete your shadow build directory and rebuild.

gpuckett
9th June 2015, 20:44
The first error comes from trying to compile the generated C++ code for the embedded resources qrc_resources.cpp. This code should not contain any reference to any of your headers. If you have not done so already delete your shadow build directory and rebuild.

I have to delete the build directory and pro.user file every time I do a build or I can't get a clean compile. Is that what you mean? That's a real hassle with the Qt Creator IDE.

I tried it again with no change.

Added after 14 minutes:

I decided to delete and rebuild the resources definitions. Deleted the build directory and the pro.user file and did a new build. Same errors.

Added after 7 minutes:

I was doing great to meet a deadline next week. Now I've been stopped dead for 4 days. Sheesh this is frustrating. I have seen similar sorts of results before. At the time it turned out I had missed a dependent include or had a few mistakes in the code. In this case I have built a very small piece of the application and gone through it closely to try to find anything wrong. I just can't. Doesn't mean I DON'T have a mistake, I just can't find it.

It is still the case that if I remove the include for global.h it builds just fine. I'm going to try to do something different with global.h. Anything to get past this. It was just extremely convenient to define these structures in one header file that I could share between other modules. I'm a great believer in the write once and reuse policy.

As you can probably obviously tell I'm not an experienced C++ programmer. I've been working on this project for almost a year but it's still just what I've learned with Qt and C++ to get the job done. I still struggle with a lot of concepts. I'm actually a java developer. Lots of stuff to really twist one's mind between the two!!!

d_stranz
10th June 2015, 01:05
It may be a red herring, but the filename "global.h" could be the cause of the problem all by itself. If there happens to be another file of the same name somewhere on the include path, it might be getting picked up instead. Try changing the name to something a bit more uncommon maybe? Or changing the #ifndef GLOBAL_H to something a bit more unlikely to be the same as a #define elsewhere?

gpuckett
11th June 2015, 18:37
It may be a red herring, but the filename "global.h" could be the cause of the problem all by itself. If there happens to be another file of the same name somewhere on the include path, it might be getting picked up instead. Try changing the name to something a bit more uncommon maybe? Or changing the #ifndef GLOBAL_H to something a bit more unlikely to be the same as a #define elsewhere?

I really hoped that would work. So I changed it to myglobal.h. Rebuild with over 100 errors as before.

Added after 26 minutes:

Making progress. Added namespace around the structs in myglobal.h. Now I can include the header and not get a lot of errors. But it causes problems with other classes in other namespaces. Looks like I'm closer. Just have to figure out how to apply the namespace properly. putting structs in namespace may be more complicated than I've understand just yet. That's what Google is for, right? :cool:

d_stranz
11th June 2015, 19:16
You should not have to do that. There's something we're all missing here, and it is likely one of those things that's been staring you in the face the whole time. Like a missing piece of punctuation or something stupid like that.

You may be able to avoid some of the other compilation errors by putting a "using namespace xyz;" declaration at the top of C++ or other files that use these classes. But it just screams "kludge!".

gpuckett
11th June 2015, 21:52
I finally resolved the problem. There was an unclosed bracket on a namespace definition somewhere else in my code. I think I understand why this happened from a C++ perspective but I still find the resulting errors frustrating. This is one of those things where C++ is tremendously different from Java. I looked at that code for hours. Just couldn't see the problem. I want to say thank you to everyone who responded. I admitted up front that I had already assumed it was a stupid mistake. Maybe it's just Qt Creator but the volume and sheer complexity of the resulting errors just led me EVERY WERE else but where the actual error occurred. I am so familiar with the way the Eclipse IDE emphasizes open and closed parens and brackets it is difficult to identify missing ones easily.

I apologize for wasting your time.

How do I mark this thread as resolved?