I am using one OpenSSL function in my simple program. But I am getting unresolved symbols for that one function. Below is my project properties setup - I've followed other posts that describe how to include OpenSSL in a project and performed those instructions. Whats wrong with my Visual Studio 2013 setup?
Error 1 error LNK2019: unresolved external symbol _SHA1 referenced in function _main
Could it be that I am using the 64 bit OpenSSL version? Is it that my project is <CharacterSet>Unicode</CharacterSet>
?
... Code generation = Multi-threaded Debug DLL (/MDd)
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\OpenSSL-Win64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\OpenSSL-Win64\lib;C:\OpenSSL-Win64\lib\VC\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libeay32.lib;libeay32MDd.lib;ssleay32.lib;ssleay32MDd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
Solution:
The problem was I was linking to the 64 bit static libraries when I should be linking to the 32 bit static libraries. That fixes it:
So change all >C:\OpenSSL-Win64\...
to >C:\OpenSSL-Win32\...
. And install the OpenSSL 32 bit installer.