Results 1 to 10 of 10

Thread: Linux to Windows

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    Sweden
    Posts
    21

    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?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    431

    Re: Linux to Windows

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

    Hope that helps.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    Sweden
    Posts
    21

    Re: Linux to Windows

    Wonderful!
    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

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: Linux to Windows

    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)

    cheers,
    John

  5. #5
    Junior Member Newbie
    Join Date
    May 2001
    Location
    Sweden
    Posts
    12

    Re: Linux to Windows

    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...
    /E

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: Linux to Windows

    Howdy,

    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 */
    main(

    /* b.h */
    void)

    /* c.h */
    printf("hi");

    /* main.c */
    void
    #include"a.h"
    #include"b.h"
    {
    #include"c.h"
    }

    cheers,
    John

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Linux to Windows

    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.
    Deiussum
    Software Engineer and OpenGL enthusiast

  8. #8
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    Sweden
    Posts
    21

    Re: Linux to Windows

    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?

  9. #9
    Senior Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    431

    Re: Linux to Windows

    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.

  10. #10
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    Sweden
    Posts
    21

    Re: Linux to Windows

    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!

Similar Threads

  1. tesselation different between linux and windows
    By wwuster in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-13-2010, 11:26 AM
  2. Linux/Windows
    By nt2010 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-06-2010, 07:52 PM
  3. Replies: 4
    Last Post: 01-30-2006, 03:25 PM
  4. Linux vs Windows
    By in forum OpenGL: Linux
    Replies: 5
    Last Post: 01-22-2002, 11:25 PM
  5. Linux to Windows again...
    By goater in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-31-2001, 06:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean