Question:
[C/C++][VC11]How to resolve error LNK2019 unresolved external symbol _CryptUIWizImport@20?
Krzysztof
2013-05-13 11:45:13 UTC
I trying to compile c++ mfc dialog based application in visual studio 2012.
I have declared CRYPTUI_WIZ_IMPORT_SRC_INFO importSrc; and it's whole structure then I tryed to type CryptUiWizImport function from
Problem turns out when I type wherever this snippet of code

CryptUIWizImport(
CRYPTUI_WIZ_NO_UI,
NULL,
0,
&importSrc,
NULL
);

Program is compiled successfully without this snippet.
I tried include directly to project without any result. I've read tips from MSDN about this error but couldn't figure out how to fix it anyway.

Thanks in advance for help
Three answers:
Michael
2013-05-13 12:11:19 UTC
Hello,



_CryptUIWizImport is defined in Cryptui.lib; the project must link with this import library if not already done so. The project may build without the library linked if no references are made due to no imported symbols. Once a symbol is imported (i.e., like the call) it will fail to build.



The following methods should work to link the library file. Method 2 or 3 is recommended for portability but the first method is the simplest.



Method 1.

Use #pragma comment (lib, "Cryptui.lib") in code somewhere in the project. This is MSVC specific though and non portable.



Method 2.

In the MSVC IDE, go to Project properties->Linker->Input->Additional Dependencies and add "Cryptui.lib". Hit Apply.



Method 3

If using NMake or command line, it is added by just passing the library file to link.exe.
anselmo
2016-11-08 14:10:40 UTC
Unresolved External Symbol C
Laurence I
2013-05-13 12:07:35 UTC
take a look at this example maybe


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...