So first I'll say I've looked in a ton of places to no success.
This PDF is where I started:
http://curl.haxx.se/libcurl/c/visual_studio.pdf
It seems outdated and does not include instructions for statically linking libraries. Or at least, I've tried following all of the instructions without any success.
I've tried following answers in
Installing LibCurl on Visual Studio 2010
error LNK2019: unresolved external symbol libcurl Visual studio
Building libcurl library in Visual Studio 2008
and other areas, but have not made any progress.
I will also say that I am NOT a Windows user by any stretch of the imagination. With that said I will lay out what I have done so far.
I am porting over an application I made in a Unix environment, specifically OSX. I've made a lot of progress with the exception of using libcurl. I need to statically link LibCurl so that the executable built by Visual Studio can be moved to other Windows devices as necessary without needing dlls for libcurl or MySQL (which I am also linking statically).
Anyway, with the gracious help of this repository:
https://github.com/blackrosezy/build-libcurl-windows
I was able to build libcurl onto my Windows device. This was a difficult process before I found this repository. Now I have a lib and an include folder. Inside the lib folder there are release and debug folders for dll and static builds each. Inside the static-release folder I have ONLY libcurl_a.lib. Inside the dll-release folder I have libcurl.dll, libcurl.lib, and libcurl.pdb.
I have gotten the program to SUCCESSFULLY build when dynamically linking from the dll-release
folder. However, when I try to link statically from the static-release folder, I get 11 or so linker errors.
I have also included "libcurl_a.lib"
, "wldap32.lib"
, "ws2_32.lib"
, "winmm.lib"
, "libeay32.lib"
, and "ssleay32.lib"
as dependencies.
In addition to all of this, I used NuGet to get libssh2.1.4.3.1
, openssl.1.0.1.21
, zlib.1.2.8.1
along with redist versions of all of these. I have included the following paths in my library directories as well:
path_to_libssh\build\native\lib\v110\Win32\Release\static\cdecl\<br>
path_to_openssl\build\native\lib\v110\Win32\Release\static\cdecl\<br>
path_to_zlib\build\native\lib\v110\Win32\Release\static\cdecl\<br>
I have also put the /include/
paths from these folders in my list of include directories.
In my preprocesser definitions I have "CURL_STATICLIB"
.
However, despite all of these steps that I have taken from multiple sources including some great answers on this site, and the PDFs and some answers on the LibCurl site, I am still having these linker errors.
As an example, one of the errors that I feel is slightly indicative (sorry I cannot copy and paste all of these errors from VS2013 that I can tell) says:
"error LNK2019: unresolved external symbol curl_easy_setopt referenced in function 'public:__cdecl Curler::Curler(char*)'(??0Curler@@QEAA@PEAD@Z)"
All of these errors are laid out similarly, pointing to some sort of __cdecl Curler
function, with the error code LNK2019.
Anyway, my question is basically: what am I doing wrong? I am sorry if this is a vague question, or if you feel as though this is a repeat. But I can assure you that I have looked at a large list of Stack Overflow questions and other areas of the internet with no success, and I've begun to feel very lost. Things that seem to work for so many others I just cannot get to work. I think a large portion of the problem is my newness to Windows. If there is any other information that I can provide in order to help you help me, then I will gladly provide it. I really appreciate any help you can give me. Thanks.