Skip to main content
gamedev.net
🔒 Locked

.h & .cpp problem

Started by Kris2456 2 replies 350+ views
Original Post
Kris2456
Kris2456
hi, i lately tried to organise my code into different source files, but it is annoying me beacuse i cant get it to work. For example: i have a file called object.cpp , and a header called header.h. i did some drawing code in it (with textures), and put it all in a function, void TieFighter(). When i tried to compile this it said that there was an undefine reference to a variable (called TexID) in the main.cpp file. So i tried puttin an "extern" in front of it, eg: "extern unsigned int TexID" but it gave me the same errors, and i cant even get a camra clas to load from it. i have done the #include "header.h in both of them, so im confused. Is it my code, or have I included something wrong, please help. ----- "Here lies a toppled God, His fall was not a small one, We but built his pedastle, A narrow, and a tall one" Frank Herbert (Dune:Messiah)
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)
Trienco
Trienco
where is texid declared/defined?

simple and maybe usual way

bla.h

extern unsigned int Variable;

bla.cpp

unsigned int Variable;
f@dzhttp://festini.device-zero.de
SiCrane
SiCrane
You might want to read this article and see if it answers your questions.

Topic Locked

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

Sign in to reply to this topic.