Qt QPainterpath.h errors - c++

I am currently working on a Qt application with many #include files from the Qt library. The project is quite large and I have encountered a strange problem when building. The errors displayed are all inside the QPainterpath.h file, but has nothing to do with calls to it from my project. The errors all look like this:
c:\qt\4.8.4\include\qtgui../../src/gui/painting/qpainterpath.h(397) : error C2143: syntax error : missing ';' before '::'
c:\qt\4.8.4\include\qtgui../../src/gui/painting/qpainterpath.h(397) : error C2059: syntax error : '::'
c:\qt\4.8.4\include\qtgui../../src/gui/painting/qpainterpath.h(398) : error C2143: syntax error : missing ';' before '{'
c:\qt\4.8.4\include\qtgui../../src/gui/painting/qpainterpath.h(398) : error C2447: '{' : missing function header (old-style formal list?)
c:\qt\4.8.4\include\qtgui../../src/gui/painting/qpainterpath.h(405) : warning C4003: not enough actual parameters for macro 'elementCount'
I encountered this once before and was able to solve it by moving some Qt #include statements called before other class headers below them. I can't seem to figure out what in particular is causing it this time though. Any thoughts would be great!
Thanks!

I've seen this happen when you forget to close a class definition with a semicolon. If you look at the output from the compiler, and see which file was compiled right before this error started, you may have your answer. Look for syntax errors with missing a ; or an extra } or a missing } at the end of the previously compiled file.
It could also be from a .h file listed above your #include <QPainter> call that has the errors.
Hope that helps.

I'm working with RyGuyFalcore and figured out why this is happening in our code, and nobody else is seeing it. The issue is that our legacy code was redefining the elementCount macro. Therefore, if we included that portion of our legacy code before we included the Qt code, the wrong macro was getting used :( Figured I would post this here to avoid any wild goose chase that others may run into if they hit a similar bug.

Related

Error D8003: missing source filename and CMap

I'm working on a C++ solution. It builds and runs just fine on my main computer, but transferring it to a different computer results in those build errors:
Error D8003: missing source filename in cl
Error C2143: syntax error : missing ';' before '<' at the declaration of a CMap in the header file.
Could someone direct me to the possible causes of this?
It does seem that you need to have #include <afxtempl.h> in your src/header file.

Errors building Freetype application with Visual Studio

I've been going bonkers the last week on this problem.
Microsoft Visual Studio Community 2013
Freetype 2.5.5
Windows 8.1
Building as C++ application
I've been trying to build against a static library for Freetype, I've tried after building the lib using the included VC2010 project and also downloading a pre-built library with no luck. I always get the same errors below. I've tried with multiple examples and the same. I'm able to successfully compile and link against the lib using gcc (after building a .a library), this problem seems to be isolated to Visual Studio..
1>f:\audio\libs\header\freetype\fterrdef.h(35): error C2143: syntax error : missing '}' before '('
1>f:\audio\libs\header\freetype\fterrdef.h(35): error C2143: syntax error : missing ';' before '<L_TYPE_raw>'
1>f:\audio\libs\header\freetype\fterrdef.h(35): error C2059: syntax error : '<L_TYPE_raw>'
1>f:\audio\libs\header\freetype\fterrors.h(164): error C2143: syntax error : missing ';' before '}'
1>f:\audio\libs\header\freetype\fterrors.h(177): error C2059: syntax error : '}'
1>f:\audio\libs\header\freetype\fterrors.h(177): error C2143: syntax error : missing ';' before '}'
1>f:\audio\libs\header\freetype\freetype.h(38): error C2143: syntax error : missing ';' before '{'
1>f:\audio\libs\header\freetype\freetype.h(38): error C2447: '{' : missing function header (old-style formal list?)
Example code that can cause this error:
#include <windows.h>
#include <ft2build.h>
#include FT_FREETYPE_H
int main(int argc, char **argv)
{
return 0;
}
I had the same issue while building FreeType2 in VS2013 with VS2013 toolset (SDK). No Google results seem to have answer to this so far so I thought I'd share even though the thread is bit old (but the problem is still recent! FreeType ver. 2.6 still suffers from the same problem).
For reference, this can be reproduced by minimal example:
#include <ft2build.h>
#include FT_FREETYPE_H
FT_Library library;
So the problem and solution is quite simple but was unfortunately buried in output log and wasn't that obvious at first glimpse so it needed some investigation.
There is a clash with header names between FreeType2 library and Windows SDK, namely with the fttypes.h file which gets dragged in from:
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\fttypes.h
Instead, VS should include FT2 header that is located in:
your_FT2_root\include\fttypes.h
This is easy to workaround - in your Project Properties (Alt+F7) rearrange header search paths so FreeType2 path is first (for me bringing FT2 at the top worked like a charm).
Hope this helps!
Cheers,
Henryk

Compiler error when running Simulink models from Visual Studio

I have compiled all subsystems of a big, complex, Simulink model into a series of dlls. All of them are working in Visual Studio except one. The one that is not working is the only one that requires the simstruc.h header file, and I get about 120 error messages when I try to compile them. Most of them are in simstruc.h, but also in subsequent includes, like sfcn_bridge.h for example. All of them look the same way:
error C2143: syntax error : missing ';' before '*' c:\matlabr2011b_x86\rtw\c\src\sfcn_bridge.h (37)
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\matlabr2011b_x86\rtw\c\src\sfcn_bridge.h (37)
.
error C2143: syntax error : missing ';' before '*' c:\matlabr2011b_x86\simulink\include\simstruc.h (2135)
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\matlabr2011b_x86\simulink\include\simstruc.h (2135)
The code in the line in above example looks like this:
sfcn_bridge.h (37):
SS_SimMode *simModePtr;
simstruc.h (2135):
SparseHeader* slvrJacobianMatrix;
I have been able to compile programs that include simstruc.h before, but suddenly it's not working. Can anyone point me in the right direction?
Check if any of your class declaration missing ";" at the end.
class AAA
{
}; <--- this one
Edit:
Try these tips as well.
Rebuild the project
Right Click on each cpp file and click "Compile" to identify infected files.
Check include paths. specially sub folders in simulink include directory.
Go to the declaration of SparseHeader struct and check if it get skipped by any #ifdefs or any preprocessor definitions.
If your code base is small, comment out half of it until you get a compilable code. This is not easy however.

missing ';' before namespace when using boost 1.4.2

Working on moving some C++ code from Linux over to Windows. The code uses boost 1.4.2, however it keeps failing out on building the boost modules. Basically, every boost hpp file that happens to contain "namespace boost" errors with:
error C2143: syntax error : missing ';' before 'namespace'
Any idea what could be causing this?
Loss of ; before including Boost header could be cause of that. The following code produce such error:
struct X {} // << ; lost here
#include <boost/shared_ptr.hpp>
This small code gives me the following error:
boost/config/suffix.hpp(460) : error C2143: syntax error : missing ';' before 'namespace'
Have you tried including these boost headers on the first line? If they compile fine that way, it's likely a missing ; in one of the headers included before them.

OOLua compile errors

Code
#include <OOLua/oolua.h>
class foo
{
public:
int bar();
};
OOLUA_CLASS_NO_BASES(foo)//class has no bases
OOLUA_NO_TYPEDEFS
OOLUA_MEM_FUN_0(int,bar)
OOLUA_CLASS_END
Compiler output
main.cpp(21) : error C2061: syntax error : identifier 'bar'
main.cpp(22) : error C2143: syntax error : missing ';' before '}'
main.cpp(22) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
main.cpp(22) : warning C4183: 'OOLUA_MEM_FUN_0': missing return type; assumed to be a member function returning 'int'
Using
Visual Studio 2008
OOLua 1.2.1
(OOLua .lib has been built and linked to)
Links
http://code.google.com/p/oolua/
Question
How can it be fixed? The code segment is from the 'Cheat Sheet' of OOLua's google code website.
Solved -> but still has problems
OOLua link errors
I am sorry you are having problems with the library, there is a mailing list set up for problems such as you are seeing http://groups.google.com/group/oolua-user?pli=1
The problem is due to a typo in the cheat sheet where "OOLUA_MEM_FUN_0" should read "OOLUA_MEM_FUNC_0". Thank you for drawing attention to the matter I will correct this.
Liam
It is only by chance that I have seen your message here, I would encourage you to use the forms of communication which I have detailed to you. I will not only be able to help you yet also anybody else who has similar problems.
As with any link errors for any library please post an example which displays the errors and the error messages in their entirety, as I will be more equipped to help you.
Thank you
Liam