Page 1 of 1

is this bug? [solved]

Posted: Tue May 24, 2005 5:43 am
by ijo coim
hi,
i made 3 files:
kata2.cpp
kata2.h //header file for kata2.cpp
main_kata_2.cpp //execute file for all

when i compile main_kata_2.cpp, everything is OK. but when i compile, it give me error like this:

Code: Select all

Linking...
main_kata_2.obj : error LNK2001: unresolved external symbol "public: bool __thiscall kata2::run(bool &,bool &,bool &,bool &,bool &,enum irr::video::E_DRIVER_TYPE &)" (?run@kata2@@QAE_NAA_N0000AAW4E_DRIVER_TYPE@video@irr@@@Z)
main_kata_2.obj : error LNK2001: unresolved external symbol "public: __thiscall kata2::kata2(void)" (??0kata2@@QAE@XZ)
Debug/main_kata_2.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
main_kata_2.exe - 3 error(s), 0 warning(s)
then, i recompile kata2.cpp, then i reexecute main_kata_2.cpp and it's work.

is this bug? or maybe i wrote a wrong code?
why when i execute main_kata_2.cpp for the first time it gave me some errors?

regards,

ijo coim.

Posted: Tue May 24, 2005 7:34 am
by hybrid
I think you shoudl study your compiler documentation first :lol:
There are different stages in compiling an executable. First all .cpp files are compiled to .o files (object files). These are linked together to form the executable. You're obviously linking before all object files are available. Thus, some references to methods in missing object files are printed and the executable cannot be created.
There are means to automatically build missing object files based on calculated dependencies, namely Makefiles and project files. Since you're using some MS operating system you should search for project file creation for your compiler suite.

finally

Posted: Tue May 24, 2005 9:21 am
by ijo coim
hybrid, thanks for that. now, i can see demo works for me.
before it didn't work, but, after i read your message, now i am understand.
thanks a lot hybrid.

(do you know, the demo didn't work for almost 4 months :oops: , but now it works)

regards,

ijo coim