Skip to main content
gamedev.net
🔒 Locked

include problem

Started by hello_there Mar 18, 2003 at 2:02 AM 4 replies 300+ views
Original Post
hello_there
hello_there
i have two files that include gl.h and those files are included in main but i get and error saying redefinition on variables. eg error C2086: ''int APIENTRY'' : redefinition it says that heaps of times how do you stop this from happening. it works in my other programe but not in this one.
____________How could hell be worse?
Raab314159
Raab314159
Are are sure your header files contain a check?

#ifndef unique_name
#define unique_name

//your declarations

#endif
hello_there
hello_there
yeah they do but shouldn''t the gl.h file have that in it to? but it doesn''t seem to.
____________How could hell be worse?
jlebrech
jlebrech


main.c

#include "main.h"

int whatever;


-----------

main.h

#ifndef _MAIN_H
#define _MAIN_H

extern int whatever;


#endif
------------

other.c

include "main.h"


hello_there
hello_there
yeah i know but it's more like this. i don't have a main.h just a file that has the variable and function definitions.

main.c

#ifndef _MAIN_C
#define _MAIN_C

#include "file.h"
#include "file2.h"

#endif

-----------------

file.h

#ifndef _FILE_H
#define _FILE_H

#include <gl/gl.h>

#endif

-----------------

file2.h

#ifndef _FILE2_H
#define _FILE2_H

#include <gl/gl.h>

#endif

[edited by - hello_there on March 18, 2003 4:21:49 AM]
____________How could hell be worse?
Qw3r7yU10p!
Qw3r7yU10p!
what does the #ifndef achieve in main.c ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.