Win32 API functions?

  • Thread starter Thread starter dragonslayer008
  • Start date Start date
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)
 
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).
 
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.
 
Back
Top