libcurl - LNK2019: unresolved external symbol curl_global_init - c++

I'm new to C++, and I've been struggling for the past 2 days trying to get libcurl to work. I'm on Windows, with VS 2012, and need to use libcurl for a x64 project. I have scoured the internet and SO for a solution that will help me, but not a single one has helped. I especially tried this link, which seemed to be the closest to what I need in the easiest possible instructions, and even that failed.
The error I am getting is a linker error, one for each call to any libcurl function.
error LNK2019: unresolved external symbol curl_global_init referenced in function main
To clarify,
I have added libcurl/include to VC++ Directories -> Include Directories AND to C/C++ -> Additional Include Directories
libcurl/lib/static-debug to VC++ Library Directories
CURL_STATICLIB to C/C++ -> Preprocessor -> Preprocessor Definitions
libcurl/lib/static-debug to Linker -> Additional Library Directories
Full path to libcurl\lib\static-debug\libcurl_a_debug.lib to Linker -> Input -> Additional Dependencies.
Can someone please tell me if I'm doing anything wrong here, or if not, what on earth I can do to solve this? It's getting extremely frustrating, and I'm desperate.

Related

Questions about third-party library(oat++) configuration in visual studio

As a beginner, I want to use oat++ as a third-party library in visual studio, but I encountered some configuration problems.
First I downloaded the source file of the oat++ project and opened it in visual studio and cmake and install.
Then I created a new project in visual studio and started running the first example of the official website.
First of all, it need to configure the preprocessing, I will configure the Include directory first.
What I did is:(my project name is web4)
Project -> Web4 properties -> configuration properties -> VC++ Directories
set the Include Directories include C:\Users\13925\Documents\cpp\oatpp\out\install\x64-Debug\include\oatpp-1.2.5\oatpp
That is great. The compiler can find the #include "file"
After that I'm having trouble,An error occurred when I tried to compile.
Error LNK2019 unresolved external symbol __imp_WSAStartup referenced in function....
By searching for information, it is found that the cause of this problem is that the related library is not included.
But I tried the online method and it didn’t solve the problem,so ask for help here.
The online approach is like this:
Project -> Web4 properties -> configuration properties -> VC++ Directories
set the Library Directories include C:\Users\13925\Documents\cpp\oatpp\out\install\x64-Debug\lib\oatpp-1.2.5
In C:\Users\13925\Documents\cpp\oatpp\out\install\x64-Debug\lib\oatpp-1.2.5 has three files:oatpp.lib、oatpp-test.liband a .hfiles.
Project -> Web4 properties -> configuration properties -> Linker -> Input
set Additional Dependencies include oatpp.lib and oatpp-test.lib
Compile after completing the above four steps and find that the problem is still not solved.
And the problen still unresolved external symbol.
I would be very grateful if you are willing to help.
As far as I'm concerned, the problem is you are not linking against the Ws2_32.lib library. To fix this you could try to add that to your additional dependencies tab of linker/Input settings for your project. And you could also try to add: #pragma comment(lib, "Ws2_32.lib")
Best Regards,
Jeanine

Visual Studio 2015 (C++) sqlite3.dll unresolved external symbol

I cannot figure out how to get sqlite3.dll (or any dll for that matter) to work with my C++ project in Visual Studio.
The error message I get is LNK2001 unresolved external symbol sqlite3_open
Here's what I did so far:
I put the .dll in myProjectFoler/Resources/sqlite3.dll
I generated sqlite3.lib using Visual Studio Developer Command Prompt using a command lib /def:sqlite3.def
I referenced the directory with the lib in Project -> Preferences -> Linker -> General -> Additional Library directories, and then referenced the .lib in Project -> Preferences -> Linker -> Input-> Additional dependencies
I placed sqlite3.h in my project and #included it
(pretty much followed the instructions seen here)
Thank you for help
The issue is that by default the header file assumes that sqlite is linked statically, as opposed to dynamic linking to a dll.
This part of sqlite3.h is responsible for that:
#ifndef SQLITE_API
# define SQLITE_API
#endif
If you set a per-project define in project properties:
SQLITE_API=__declspec(dllimport)
this should resolve your link error.
Alternatively, you can put
#define SQLITE_API __declspec(dllimport)
right before where you #include sqlite3.h.
It's difficult to tell exactly why the problem occurred. There are lots of reasons which could cause LNK2001 error. MSDN contains good check list.
You could try to use /VERBOSE option to determine which files the linker references. Put this option in Project -> Preferences -> Linker -> Command Line -> Additional Options. Output should contains similar strings:
Searching e:\SQLite\sqlite-dll-win32-x86-3150100\sqlite3.lib:
Found _sqlite3_open
Referenced in ConsoleApplication2.obj
Loaded sqlite3.lib(sqlite3.dll)
Pay attention to the VS runtime libraries, there should be no mixup between Debug and Release libraries.

How do I resolve linker error LNK2019 while including "zlib" in my Visual Studio 2013?

I got the precompiled "lib" and "dll" from here: http://zlib.net/zlib128-dll.zip
I am compiling my project in x64.
I added directory into "Additional Include Directories"
I added the "zdll.lib" to Linker -> Additional Dependencies.
I added the library directory to Linker -> Additional Library Directories.
I also added the Post-Build Event "xcopy ..\oem\zlib\*.dll "$(TargetDir)"
But I still get the Linker error:
: error LNK2019: unresolved external symbol inflateInit_ referenced in function
Thanks.
IS that a 32-bit dll? If so, you'll have to obtain, or build your own, 64-bit version.
The linker error happens with the lib file, if you have the right headers it'll compile, if you have the right lib, it'll link, if you have the right dll, it'll run.

SCIP and Visual Studi: error LNK2019

I want to solve the n-queens problem using SCIP (version 3.2.1) in Visual Studio 2010 (version 10.0.40219.1).
Source files can be found here: http://scip.zib.de/download/files/Queens.tgz
I did not write any code myself, but just included queens.hpp, scip_exceptions.hpp, queens.cpp and queens_main.cpp in my VS project.
In the project properties I did the following:
C/C++ -> General -> Additional Include Directories -> C:\scipoptsuite-3.2.1\scip-3.2.1\src\.
When building, I get errors like:
LNK2019: unresolved external symbol SCIPaddCons referenced in function "public: __thiscall cipexamples::QueensSolver::QueensSolver(unsigned int)"
I understand that I will have to link SCIP libraries to my project? But I do not know which ones and where to find them?
You need to compile the SCIP Optimization Suite first to obtain the libscipopt that you need to link to your project. It will contain everything necessary to work with SCIP.
Alternatively, you may also just use the precompiled dlls from the webpage:
http://scip.zib.de/#download

Installed MPI but still linker error LNK2019 appears

I've installed MS-MPIv5 from Microsoft and also the debugger for msmpi. In proejct properties in VS2012, I've changed C/C++ -> Additional include libraries adding "$(MSMPI_INC); $(MSMPI_INC)\x64" and also Linker -> All options->Additional Dependencies adding "msmpi.lib;", but VS is still giving me al lot of linker errors such as
error LNK2019: unresolved external symbol _MPI_Barrier#4
unresolved external symbol _MPI_Bcast#20
and so on, with all the mpi functions or type of variables. Is there something I forgot to change or add?
I haven't used 2012, but if it's similar to the older versions of VS then this detailed link may help. In general make sure to do these 3 things:
Add the "Additional Include Directories"
Add the "Additional Library Directories"
Add the "Additional Dependencies" (msimpi.lib)
It sounds like you may be missing the 2nd step?
Try $(MSMPI_INC)x64 (no \)
In my PC
MSMPI_INC=C:\Program Files (x86)\Microsoft SDKs\MPI\Include\