![]() |
Function to function as pointer strange error
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 |
Re: Function to function as pointer strange error
i stupid forgot to declare it as
void TKeyboard::setWhilePressedCallback but had it as void setWhilePressedCallback the MVS degugger is terrible PROBLEM SOLVED |
Re: Function to function as pointer strange error
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?
|
Re: Function to function as pointer strange error
Quote:
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 |
Re: Function to function as pointer strange error
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.
|
| All times are GMT +5.5. The time now is 23:20. |