Linux to Windows

I’ve got a game working under Linux, now I’m trying to get it work under Windows. The thing is I get a strange compiling error in Visual C++:
c:\include\GL\gl.h(1152) : error C2144: syntax error : missing ‘;’ identifier before…
Obviously there are some settings or likewise that I’ve missed.
Does anyone have a clue?

Make sure you #include <windows.h> before you #include <GL/…>. If you’ve already done that, then I’m not sure.

Hope that helps.

Thanks a lot, that was indeed the problem…or at least THAT problem, I’ve got a couple more of them
Do you know if #include <string> should work in windows?

Thanks again.

/a happy goat

of course it should. its not a ‘windows’ thing, either, but a pre-processor thing.

< > means ‘search the include path’, and
" " means ‘search the currect directory’

if your preprocessor is not finding <string>, then make sure ‘strings’ location is in your include path (-I<path> on commandline compilers)


I was under the impression that the

#include <string>

atribute was a part of the standard c++ libraries… Maybe I’m wrong, but shuldn’t this work with any compiler claming to be able to recognize standard c++ syntax?! As I said I might be wrong… Please correct me and tell me where I fail if I do so…


everything beginning with ‘#’ is a pre-processor directive. The underlying C compiler never sees source code with #<something>. The pre-processor scans the source for #<something> and acts on it. (Some of them use a hack and just chck to see if the first char of each line is a ‘#’. in this case, source code that has <tab>#include won’t work =)

its like this:

<src> -> [preprocessor] -> <outsrc> -> [compiler] -> <objectcode> -> [linker] -> <executable>

#include is a pre-processor hack (a HACK, damnit=) because C doesn’t support multiple files. Some languages, like Java and Ada, inherently KNOW that the project is built of multiple source files. BUt not C; as far as the compiler is concerned, there is only ever one source file. True, it might not be executable, but… hey! thats the job of the linker.

#include is not a compiler specific thing. You can use the same preprocessor on anything, actually… like a text file (#include"chatper1.txt", for a book, if you wanted=). include files don’t necessarily have to have function prototypes in, either. aYou could so something like this:

/* a.h */

/* b.h */

/* c.h */

/* main.c */


What version of VC++ are you using? VC++ 6.0 does have the string header, but I can’t say for sure that older versions did. (I didn’t use STL way back when I had 5.0 and 4.0)

Also, do you get an error on the include or on another line… The string object is placed in the std namespace so unless you do this…

using namespace std;

or this…

std::string str;

or this…

typedef std::string String;

String str;

You are likely to get errors saying that “string” is unrecognized.

I get about 100 errors, all complaining on different operations with my strings. Like “YourString must be of class/struct type…something”
I’m maybe not being crystal clear to you guys, but hopefully you’ll understand?

If you’re not getting an error similar to “Include file ‘string’ not found” and your errors are “… must be of class/struct type …” then I’m guessing it’s because you are passing wrong parameter types to functions. I’ve seen errors like this before and it’s because there is no implicit type conversion for your parameters. A function will expect say const &T and you’re trying to pass it &S or something. Cut and paste some detailed error messages into a post so we can see more information.

Hope that helps.

Hello again!

By adding the line “using namespace std” i managed to get rid of all compile errors. However, now I’m stuck with a lot of linker errors. Most of them are “unresolved external symbol” and seem to have something to do with the string class:

error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<

I’m having a hard time figuring out what this means. Does anybody have some advice on how to fix this?

Thanks in advance!