Win32 API functions?

D

dragonslayer008

I moved some unmanaged C++ code into a C++/CLI project. The unmanaged
code makes some Win32 API calls. I thought as long as I kept the API
calls in a native class, it would integrate seamlessly. However, I am
getting a whole bunch of linker errors with regards to the API calls:

Example:

error LNK2028: unresolved token (0A00001A) "extern "C" int __stdcall
MessageBoxA(struct HWND__ *,char const *,char const *,unsigned int)" (?
MessageBoxA@@$$J216YGHPAUHWND__@@PBD1I@Z) referenced in function
"public: void __clrcall D3DException::showMsg(void)" (?
showMsg@D3DException@@$$FQAMXXZ)
 
S

SvenC

Hi Dragonslayer (real names are welcome, btw),
I moved some unmanaged C++ code into a C++/CLI project. The unmanaged
code makes some Win32 API calls. I thought as long as I kept the API
calls in a native class, it would integrate seamlessly. However, I am
getting a whole bunch of linker errors with regards to the API calls:

Example:

error LNK2028: unresolved token (0A00001A) "extern "C" int __stdcall
MessageBoxA(struct HWND__ *,char const *,char const *,unsigned int)" (?
MessageBoxA@@$$J216YGHPAUHWND__@@PBD1I@Z) referenced in function
"public: void __clrcall D3DException::showMsg(void)" (?
showMsg@D3DException@@$$FQAMXXZ)

You still need to tell the linker which libs to bind. MessageBox comes from
user32.dll. So check your linker settings in your project properties. Don't
forget to add the libs for debug and release (or all the configs you use).
 
D

dragonslayer008

Hi Dragonslayer (real names are welcome, btw),


You still need to tell the linker which libs to bind. MessageBox comes from
user32.dll. So check your linker settings in your project properties. Don't
forget to add the libs for debug and release (or all the configs you use).

Thanks. I forgot managed applications don't link that by default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top