0

I'm trying to include libcurl into my C++ Project, therefore i built the .lib file placed it in a folder called "curl/lib" and then i copied the included folder from the curl folder i downloaded into "Curl/" (i got that from a tutorial online...). Then i copied that "curl" folder i created into the directory where my program is located, then i added the curl path to "Additional Include Directories" und "C++/General" and "Linker/General" in my Project Properties. Then i created a piece of code that uses stuff from that uses code from curl.h (i included that). And the codingg looked fine and there were no errors, but then i built my Project and i got a "fatal error LNK1120: 6 unresolved externals" error and a bunch of "LNK 2019"-errors, told me where the unresolved symbols are:

1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_cleanup referenced in function "void __cdecl lel(void)" (?lel@@YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_strerror referenced in function "void __cdecl lel(void)" (?lel@@YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_perform referenced in function "void __cdecl lel(void)" (?lel@@YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_setopt referenced in function "void __cdecl lel(void)" (?lel@@YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_easy_init referenced in function "void __cdecl lel(void)" (?lel@@YAXXZ)
1>dll_load.obj : error LNK2019: unresolved external symbol curl_global_init referenced in function "void __cdecl lel(void)" (?lel@@YAXXZ)

anyone knows what i'm missing or how i can fix this, because it's really annoying and stops me from finishing my project! Any help is greatly appreciated!

Dafuqisthis
  • 1
  • 1
  • 6

1 Answers1

0

It sounds like visual studio (windows), but the same thing applies to any compiler. You tell it where to look for a library file, but you didn't tell it to actually use libcurl, so it didn't look for it.

In visual studio, try Linker, Input, Additional Dependencies add "libcurl.lib" (or whatever the actual name is).

Kenny Ostrom
  • 5,639
  • 2
  • 21
  • 30
  • okay, i did that, but now im getting this error: LNK1181: cannot open input file 'libcurl.lib' – Dafuqisthis Aug 04 '16 at 19:54
  • https://msdn.microsoft.com/en-us/library/y6b12xkc.aspx "The linker could not find filename because it does not exist or the path was not found." You misspelled something, or need to put quotes around a path with spaces? – Kenny Ostrom Aug 04 '16 at 19:56
  • Also try using the full path, if the relative paths are giving you trouble. If that works, then you know you need to fix the relative paths. – Kenny Ostrom Aug 04 '16 at 19:58
  • okay, i added this(the name of the libary) to the Additional Dependencies: "libcurl.lib"(w/o quotations) ... then i added this file path to "Additional Include Directories" und "C++/General" and "Linker/General": "D:\Folder1\Folder2\Project Folder;%(AdditionalLibraryDirectories)"(w/o quotations), the directory where libcurl.lib is located is: "D:\Folder1\Folder2\Project Folder\curl\lib\" – Dafuqisthis Aug 04 '16 at 20:02
  • Compile succeeded, so don't mess with "Additional Include Directories" – Kenny Ostrom Aug 04 '16 at 20:05
  • You messed up the path. You just posted one thing for the actual path, and something completely wrong for where you told the linker to look. – Kenny Ostrom Aug 04 '16 at 20:06
  • i set "D:\Folder1\Folder2\Project Folder\curl\lib"(w/o quotations) as "Additional Include Directories"-path in "C++/General" and "Linker/General"... and now i get this error: "libcurl.lib(mprintf.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'PPCBE'" – Dafuqisthis Aug 04 '16 at 20:15
  • You will need to build libcurl and your project with the same target machine type. (usually it's covered by the configuration, but you can also look at Linker, advanced, target machine) – Kenny Ostrom Aug 04 '16 at 20:25
  • so the c++ script i code is for xbox is that a problem!? i'm so frustrated at the moment why cant it not just work... – Dafuqisthis Aug 04 '16 at 20:45