hello
i needed to make a callback function, i read a lots of articles and created this (i used this principe on simple code, and added it to my program)
Code:
class TKeyboard {
public :
...
void setWhilePressedCallback(void (*func) (int));
private :
...
};
void setWhilePressedCallback(void (*func) (int)) {
...
}
but now iam getting this error after i call
keyboard.setWhilePressedCallback(test); /*void test(int x) {}*/
1>camera.obj : error LNK2019: unresolved external symbol "public: void __thiscall TKeyboard::setWhilePressedCallback(void (__cdecl*)(int))" (?setWhilePressedCallback@TKeyboard@@QAEXP6AXH@Z@Z ) referenced in function _main
1>F:\Work\Visual Studio\my\camera\Debug\camera.exe : fatal error LNK1120: 1 unresolved externals
the full source is at
politea.sk/tmp/camera.rar
THANK YOU FOR HELP
|
Newbie Member
|
|
| 6Aug2009,20:03 | #2 |
|
i stupid forgot to declare it as
void TKeyboard::setWhilePressedCallback but had it as void setWhilePressedCallback the MVS degugger is terrible PROBLEM SOLVED |
|
Mentor
|
![]() |
| 9Aug2009,00:58 | #3 |
|
Why is the debugger terrible? The error you got was (a) a linker error not a debugger error, and (b) exactly absolutely 100% totally correct and helpful in that it pointed you unambiguously directly at the cause of the error. How do you think the linker could be improved in that regard?
|
|
Newbie Member
|
|
| 9Aug2009,14:14 | #4 |
|
Quote:
Originally Posted by xpi0t0s 1>camera.obj : error LNK2019: unresolved external symbol "public: void __thiscall TKeyboard::setWhilePressedCallback(void (__cdecl*)(int))" (?setWhilePressedCallback@TKeyboard@@QAEXP6AXH@Z@Z ) referenced in function _main 1>F:\Work\Visual Studio\my\camera\Debug\camera.exe : fatal error LNK1120: 1 unresolved externals in Borland C++ it points you nice to the line where you have an error and understandably says whats wrong.... just everybody is saying how great MVS studio is, and that i need to evolve frmo Builder To Studio...so iam working in it |
|
Mentor
|
![]() |
| 9Aug2009,15:18 | #5 |
|
How can Borland C++ point you to a line that doesn't exist? Unresolved External Symbol usually means you haven't written that function (it could also mean you haven't included a library in the link line), so no line number is possible.
|


