Search code examples
visual-c++linkermsdnidn

IdnToAscii linker error


I am trying to use IdnToAscii in my code. Accourding to msdn

http://msdn.microsoft.com/en-us/library/windows/desktop/dd318149(v=vs.85).aspx

all I need is kernel32.dll. But I receive linking error when trying to build:

Error 1 error LNK2019: unresolved external symbol __imp__IdnToAscii@20 referenced in function _wmain.

Including normaliz.lib to project solves the issue.

The question is why do I have to include it. Is it a mismatch in msdn documentation or I am missing something.

Thanks


Solution

  • Please check the 'Requirements' paragraph of the MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318149%28v=vs.85%29.aspx

    There you can see that the IdnToAscii method is in the Normaliz.dll (not kernel32.dll)and to use this method you have to includes Normaliz.lib.