Archived

This topic is now archived and is closed to further replies.

Prod

Mixing tuts

Recommended Posts

I was trying to Mix Nehe''s Lesson35 with gametutorials.com camera part 2 tutorial... Well i went the wrong direction and tried to add the camera code to nehe''s instead of putting the drawing code in the camera tut. So i got these wierd errors doing it lesson35.obj : error LNK2001: unresolved external symbol "public: __thiscall CCamera::CCamera(void)" (??0CCamera@@QAE@XZ) Lesson35.obj : error LNK2001: unresolved external symbol "public: void __thiscall CCamera:ositionCamera(float,float,float,float,float,float,float,float,float)" (?PositionCamera@CCamera@@QAEXMMMMMMMMM@Z) Lesson35.obj : error LNK2001: unresolved external symbol "public: void __thiscall CCamera::RotateView(float,float,float)" (?RotateView@CCamera@@QAEXMMM@Z) Lesson35.obj : error LNK2001: unresolved external symbol "public: void __thiscall CCamera::MoveCamera(float)" (?MoveCamera@CCamera@@QAEXM@Z) Debug/lesson35.exe : fatal error LNK1120: 4 unresolved externals If i went the other way i dont think i would get these errors, but i want to find out how to fix them for learning reasons Any help would be nice =)

Share this post


Link to post
Share on other sites
all of those are like errors, which I get all the time. You might have accidentally misspelled the functions when you wrote them or called them with too many parameters or the wrong ones or something like that.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
No, if he had misspelled the function names or passed too many (or too few parameters) he would have had compilation errors. These are linking errors.

Unresolved external means the linker can''t find the code for an entity, be it a structure/class declaration, a variable intialization or a function body. Check that you''ve included all the necessary implementation (.cpp) and library files. Also make sure you''re linking with the correct versions of the libraries if you have multiple versions.

These are generic issues that I respond to. Someone more familiar with OpenGL, NeHe''s code and the other tutorials will probably give you more info.

Share this post


Link to post
Share on other sites
well i figured it out, but cant figure out how to fix it

the compiler is complaining that im using

BYTE g_HeightMap[MAP_SIZE*MAP_SIZE];
// Holds The Height Map Data

in more than one file, if i try and put it in a header file and just add the header file to each cpp file i need it, it says something along the lines of "all ready declared in..."

Share this post


Link to post
Share on other sites
In every file other than the one you want to "own" the array, declare it extern. For example, put
extern BYTE g_HeightMap; 
in your header file and include that everywhere. Then in your main source file (the one that contains your main()/WinMain()):
BYTE g_HeightMap[MAP_SIZE * MAP_SIZE]; 

That should clear things up.

Share this post


Link to post
Share on other sites