Re: Including headers in my project
From: muchan (usenet_at_usenet.usenet)
Date: 02/02/05
- Next message: muchan: "Re: what is wrong with this code?"
- Previous message: playwin: "Re: Good Links for adding resources"
- In reply to: Wriggler: "Re: Including headers in my project"
- Next in thread: Wriggler: "Re: Including headers in my project"
- Reply: Wriggler: "Re: Including headers in my project"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 02 Feb 2005 15:13:46 +0100
Wriggler wrote:
>
>
> Hi muchan,
>
> Thanks for the reply. That's exactly what I have, but it gives multiple
> definition errors. I've just done another quick test, which gives exactly the
> same problem:
>
> render.h
> ----------
> #include <gl/gl.h>
> #include <gl/glu.h>
>
> main.cpp
> -----------
> #include "render.h"
>
> render.cpp
> ------------
> #include "render.h"
>
> That's all there is in those three files (just a line or two). I've simply
> made a new empty Win32 application, and added the three files to the project.
> Clicking "build" will give an error about multiple definitions for everything
> inside gl.h and glu.h.
>
> I think it must be something to do with my project settings. I haven't
> actually coded anything which links main.cpp and render.cpp, they are simply
> both included in the same project. I assume VS.NET compiles these two files
> together automatically. Am I doing something wrong here?
>
> Thanks again for your help,
>
> Ben
In this case, it's "devide and conquer" method that may work.
First, compile only the render.cpp, (from the Build menu) and see if it causes
error or warnings.
Then, compile only the main.cpp and see if it causes error or warnings.
If no problem, then link (or just build not build-all) and see if it links OK.
If gl/gl.h or gl/glu.h defines something depends on Win32 or WIN32 definition,
maybe you should include "windows.h" in render.h or each .cpp files before
including the gl.h files.
Maybe these two files expect some keywords are defined for compilation,
or inconsistency of these keywords may cause multiple definitions...
Errors about semicolon is offen seen because of undefined type used in declaration
so check the line number of that error, then see what type it try to declare,
then see if some #ifdef is used for define or declare that type.
I can't think more... hope it helps.
muchan
- Next message: muchan: "Re: what is wrong with this code?"
- Previous message: playwin: "Re: Good Links for adding resources"
- In reply to: Wriggler: "Re: Including headers in my project"
- Next in thread: Wriggler: "Re: Including headers in my project"
- Reply: Wriggler: "Re: Including headers in my project"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|