Implementing CURL with Visual Studio 2010 - c++

I am trying to compile a program that uses Curl in Visual Studio 2010 on Windows Vista x64. I downloaded the latest version of Curl 7.23.1 from the official website and unzipped it to C:Program Files. From there, I opened the VCProject file in the lib directory, converted it, and built it in Visual C++ Express Version. This resulted in the creation of a debug folder in the lib folder with object files, sbr files, and a libcurl.lib file. After that I opened a W32 Console Application in Visual Studio, added the include folder to include directories, added the debug folder to library directories and additional library directories under Linker, and added libcurl.lib to additional dependencies. When trying to compile my code, I received the following errors:
Error 1 error LNK2001: unresolved external symbol __imp__curl_easy_setopt C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error 2 error LNK2001: unresolved external symbol __imp__curl_easy_perform C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error 4 error LNK2001: unresolved external symbol __imp__curl_easy_init C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error 3 error LNK2001: unresolved external symbol __imp__curl_easy_cleanup C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Run\Run.obj
Error 5 error LNK1120: 4 unresolved externals C:\Users\********\Documents\Visual Studio 2010\Projects\MainProject\Run\Release\Run.exe Run
I have tried following some tutorials online but they are all outdated. The procedure I followed is supposed to work on Visual Studio 2008. I thought that maybe I may be missing some header files or have not built/compiled parts of Curl. Thanks for any help.

I have faced almost the same issue while trying to statically link the libcurl.lib using vs2010 professional edition.
try performing a pragma link like this one in the source file. It worked for me.
#pragma comment(lib, "libcurl.lib")
or
if the path is missing in search..
#pragma comment(lib, "<full_path>/libcurl.lib")

Related

GLFW not working in Visual Studio Community

I am using Visual Studio for C++. I have tried to link GLFW in Visual Studio. The steps I went through are as follows:
Specify include directories under VC++ properties.
Specify the library directories under VC++ properties.
Add the .lib file in additional dependencies under Linker -> Input
Visual Studio recognises the header #include <GLFW/glfw3.h> and recognised glfwInit() but when glfwInit() is called it causes the build to fail. I get this build error:
LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
I then also get some unresolved externals:
LNK2019 unresolved external symbol __imp__vsnprintf referenced in function __glfwInputError
LNK2001 unresolved external symbol __imp__vsnprintf
LNK2019 unresolved external symbol __imp__sscanf referenced in function _parseVersionString
LNK2001 unresolved external symbol __imp___vsnprintf
LNK1120 3 unresolved externals
Sneaky... when I downloaded GLFW it had multiple lib folders (for the different releases) and only one include folder. I assumed that the include folder would work for all of the lib folders because there was only one. However that was not the case, the include folder only worked for the latest lib folder and I tried to use the 2013 GLFW instead of the latest 2015 GLFW lib folder with the include folder to no avail. I was using 2013 GLFW because that was the version the tutorial series I was watching used if you were wondering.

Can I use blowfish without the whole OpenSSL library?

I am trying to compile networking dll project in Visual Studio 2010. In past, the original authors used the project to produce standalone dll file that could be distributed with the server it was used for. If I open their dll, I cans see this in dependency walker (the red items are not really an issue, the dll works):
Now I tried to compile the project, but for both 32bit and 64bit (and 64bit is what I'm supposed to get to work) I produce a library that requires OpenSSL installed:
Trying to put the libeay32.lib out of the build just causes link errors:
1> Finished searching libraries
1>TTClient.obj : error LNK2001: unresolved external symbol _BF_set_key
1>TTProtocol.obj : error LNK2001: unresolved external symbol _BF_ecb_encrypt
1>D:\techsys\WebSightR220lib\Release\WebSightR220lib.dll : fatal error LNK1120: 2 unresolved externals
Turns out linking seemingly huge static library is not as big problem when you want to use just a fraction of OpenSSH. The compiler will not just copy the library in your binary, it will just pick the parts that are needed.

Visual Studio 15 __imp___iob, __imp___pctype, __imp___mb_cur_max

I am trying to use a library compiled with mingw in visual studio. However, I get the following linker errors:
error LNK2001: unresolved external symbol __imp___iob
error LNK2019: unresolved external symbol __imp___pctype referenced in function
error LNK2019: unresolved external symbol __imp____mb_cur_max referenced in function
error LNK2001: unresolved external symbol _fprintf
I was able to fix the _fprintf error by linking against legacy_stdio_definitions.lib as per this post : unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2.
However, I have no idea how to fix the other three unresolved externals. How can I fix this? The libraries work perfectly under Visual Studio 2013.
Edit:
Okay here is an update. I moved libmsvcrt.a from the mingw lib folder into Visual Studio, and I added that to the linker settings. Now it seems to work correctly.
The libraries were compiled against an old version of the CRT. The unresolved symbols you get are internal symbols of the CRT that are present in the compiled library. You have to recompile the library against the VS2015 CRT (the Universal CRT). But I'm not sure if MinGW supports this.
If you can't do that, you have to continue to use the VS2013 compiler. (You can use the VS2015 IDE, by setting the toolset to vs2013 in the project options. But you'll still be limited to the C++ features the 2013 compiler supports.)
I encountered the same problem (library compiled with static CRT instead of CRT in DLL) and I managed to make it work by changing the two following parameters in Project Properties:
Linker > Input > Ignore specific default libraries: libc.lib
C/C++ > Code Generation > Runtime Library: Multi-threaded Debug (/MTd)
If that's not enough, there's more at following page: https://social.msdn.microsoft.com/Forums/en-US/841e5723-bce4-4340-b7b3-027dcdf90f00/

Kinect + Visual Studio 2013 LNK errors, how to properly link the library?

I downloaded kinect sdk both 1.8, and 2.0. I then created a new project, and edited its properties via C/C++ and included x86 headers folders
I also edited its Linker and added its corresponding x86 libraries folder.
Yet I still get linking errors, and it's not clear to me what it may be.
error LNK2019: unresolved external symbol __imp__NuiInitialize#4 referenced in function _wmain
error LNK1120: 1 unresolved externals
Any idea? Not sure what else I can do in the linker settings.
Problem resolved,
In addition to
C/C++ include
Linker library
You also need to edit
Linker Input
In here you add Kinect10.lib (or Kinect20.lib, depending on what version you're using)

cygwin:lib not supported in visual studio 2005

i have compiled c++ files and make it as a lib using cygwin in windows. when i try to use that lib in visual studio 2005 c++. it produces the following errors.
"Error 1 error LNK2001: unresolved external symbol ___gxx_personality_v0 mylib.lib
Error 2 error LNK2019: unresolved external symbol __Unwind_Resume referenced in function _fjfx_create_fmd_from_raw mylib.lib
Error 3 error LNK2019: unresolved external symbol ___chkstk referenced in function __fjjj mylib.lib"
how to resolve it.
Yes, you need to build your library using the visual studio tools. The "gxx_personality_v0" is a symbol created by the g++ compiler, and can only be resolved by linking with the relevant libstdg++ library. Same for the other components.
Unfortunately, some parts of the runtime support for one compiler doesn't match when using a different compiler.
You could possibly get away with it if you link your Visual Studio code with the relevant GNU libraries, but I'm far from convinced.
[And I fully expect you to explain that the reason you compiled using cygwin is that the code contains a bunch of stuff that can't be compiled with Visual Studio because it uses gnu compiler extension features...]