Compile error Winamp basic plugin example in Visual Studio 2012

When you are learning the Beginner’s Basic Plugin tutorial, in order to create your first basic general plugin for Winamp, you might run into a compile error right away.

While using Visual Studio 2012 and creating the project as described in the tutorial, the first compile gave me this error:

1>------ Build started: Project: gen_myplugin, Configuration: Debug Win32 ------
1> gen_myplugin.cpp
1> Creating library I:\#C++\gen_myplugin\Debug\gen_myplugin.lib and object I:\#C++\gen_myplugin\Debug\gen_myplugin.exp
1>gen_myplugin.obj : error LNK2028: unresolved token (0A000041) "extern "C" int __stdcall MessageBoxW(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBoxW@@$$J216YGHPAUHWND__@@PB_W1I@Z) referenced in function "extern "C" int __cdecl MessageBox(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBox@@$$J0YAHPAUHWND__@@PB_W1I@Z)
1>gen_myplugin.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall MessageBoxW(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBoxW@@$$J216YGHPAUHWND__@@PB_W1I@Z) referenced in function "extern "C" int __cdecl MessageBox(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBox@@$$J0YAHPAUHWND__@@PB_W1I@Z)
1>I:\#C++\gen_myplugin\Debug\gen_myplugin.dll : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What this error basically means is that MessageBoxW cannot be found. The function resides in user32.lib, and the Linker should know where to find it. As we created the project, Visual Studio 2012 did not add the dependencies for the linker (it left the field empty). The solution is to add these dependencies manually.

Go to Configuration Properties -> Linker -> Input -> Additional Dependencies.
Click the dropdown arrow on the right and select < inherit from parent or project defaults >

dependvs2012

Now click ok.
This will in fact populate the field with all the dependencies (bunch of dll’s); You can see those if you go back to the settings again.

Save the project and try again.
Compiling should now run successfully.

1>------ Build started: Project: gen_myplugin, Configuration: Debug Win32 ------
1> Creating library I:\#C++\gen_myplugin\Debug\gen_myplugin.lib and object I:\#C++\gen_myplugin\Debug\gen_myplugin.exp
1> gen_myplugin.vcxproj -> I:\#C++\gen_myplugin\Debug\gen_myplugin.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

1 thought on “Compile error Winamp basic plugin example in Visual Studio 2012

Leave a Reply to DarkSkul Cancel reply

Your email address will not be published. Required fields are marked *