Martin Shishkov
Martin Shishkov

Reputation: 2837

Compiling C++ program using MS Visual Studio 2010 as to not depend on any external code or redistributables

I want my exe to be runnable without depending on any redistributable packages but when I set "Use of MFC" to "Use MFC in a Static Library" in the Project > Properties menu, I get errors such as this one: - Error 2 error LNK2019: unresolved external symbol _imp_GetWindowTextW@12 referenced in function _wmain So basically I get unresolved external symbol for the functions.

Thank you.

Upvotes: 1

Views: 551

Answers (2)

Mihail Shishkov
Mihail Shishkov

Reputation: 15797

In Project->Properties->Linker->Command Line type user32.lib

Upvotes: 2

Bukes
Bukes

Reputation: 3718

Under the linker settings for your project, make sure you've included the default libraries under "Additional Dependencies".

This is usually:

kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)

Also, make sure have not set "Ignore All Default Libraries".

Upvotes: 2

Related Questions