Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Weird Inclusion Problem...

SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
OK, I have a header file (structs.h) that includes windows.h and glgl.h to use certain typedefs in a structure or two. Now, if I am not mistaken, since ogl.cpp includes structs.h, shouldn't it already have included windows.h and gl.h? You see, if I don't include the two headers in the cpp file as well, it spews multiple declaration errors or other such garbage. I didn't want to have to include gl.h in my MAIN module, but since it also includes structs.h, it seems as though I MUST includ gl.h or get errors. Why is this?

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

Comments

  • gautamgautam Member Posts: 642
    Hi,

    Maybe you should change your compiler or operating system :P

    "windows.h" ?? ehh I thought you were coding the engine in linux(hehe)

    Ok - there are 2 times when I get such errors usually -
    1. When I include gl.h without including windows.h

    2. When I use some parameter like GLfloat or GLint without include gl.h in a header file like this :-

    for eg :-
    [code]
    #ifndef TEST_H
    #define TEST_H

    void Test(GLfloat x);

    #endif

    [/code]

    Maybe its not struct.h thats causing it - it might be something else completely. Maybe some header in struct.h itself ?


    : OK, I have a header file (structs.h) that includes windows.h and glgl.h to use certain typedefs in a structure or two. Now, if I am not mistaken, since ogl.cpp includes structs.h, shouldn't it already have included windows.h and gl.h? You see, if I don't include the two headers in the cpp file as well, it spews multiple declaration errors or other such garbage. I didn't want to have to include gl.h in my MAIN module, but since it also includes structs.h, it seems as though I MUST includ gl.h or get errors. Why is this?
    :
    :
    :
  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    I figured it out for the most part. I thought if I included a header into another header, I wouldn't need to include it in the cpp. I've got it compiling fine now.

    My MUD engine is in Linux, while this is a full 3D OpenGL/D3D game for Windoze. I am looking for somebody to write the D3D dll for me though. Intrestd? All you have to do is supply five basic functions to be exported and an unlimited number that the DLL may use internally.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

Sign In or Register to comment.