For my includes, I have the following
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
However, when I try to compile, I get a whole slew of errors, not related to any of the source code I am using.
Error 1 error C2825: '_Iter': must be a class or namespace when followed by '::' c:\\program files (x86)\\microsoft visual studio 11.0\\vc\\include\\xutility 364 1 mp4
Error 2 error C2039: 'iterator_category' : is not a member of '`global namespace'' c:\\program files (x86)\\microsoft visual studio 11.0\\vc\\include\\xutility 364 1 mp4
Error 3 error C2146: syntax error : missing ';' before identifier 'iterator_category' c:\\program files (x86)\\microsoft visual studio 11.0\\vc\\include\\xutility 364 1 mp4
Error 4 error C2602: 'std::iterator_traits<_Iter>::iterator_category' is not a member of a base class of 'std::iterator_traits<_Iter>' c:\\program files (x86)\\microsoft visual studio 11.0\\vc\\include\\xutility 364 1 mp4
Error 5 error C2868: 'std::iterator_traits<_Iter>::iterator_category' : illegal syntax for using-declaration; expected qualified-name c:\\program files (x86)\\microsoft visual studio 11.0\\vc\\include\\xutility 364 1 mp4
...etc...
I am not sure what xutility file is, or why the compiler is complaining about it. I highly suspect it has something to do with the way I have openGL set up with VS 2012, but I am not sure. Can anyone spot a problem with my includes?
I'm going to use my mental powers to look into your other code. ;-P
You have something like that:
#include "myheader.h"
#include <iostream>
And in the file myheader.h
you have a class declaration -or maybe a struct- but you missed the ending semicolon -or maybe the braces are mismatched.
Or maybe you have unmatched #ifdef
/ #endif
clauses.
Then the compiler is all confused when it reads the standard C++ headers and spews all these unreadable errors.
As a rule of thumb, the include headers should be in order from most standard to less standard:
Remember that included files are simply concatenated textually, and then the result is compiled all together. So an error at the end of one header file may trigger a compiler error in the next one.
instead of -
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
just use -
#include <GL/GL.h>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.