I am having a hard time linking cURL to my project on vs12 ...
I opted for the .msi solution that I picked here:
http://www.confusedbycode.com/curl/
and tried to link that to my project...
However I am still getting some errors after doing what I thought was right:
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_init referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_setopt referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_perform referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _curl_easy_cleanup referenced in function _main
My configuration in my project vs12 is the following:
I included the include folder and the the lib folder in the vc++ directories
I added CURL_STATICLIB to the Preprocessor definition in C/C++ section as well as adding the proper include folder
I added the lib folder to the Linker sectio as well as libcurl.lib
Eventually I just included "curl.h" to the relevant .cpp file...
Is there something that I am missing?
Thank you a lot
Related
I am trying to use the detours library in a visual studio empty windows project. I cloned the repository (https://github.com/microsoft/Detours), I added the include directory into Project Properties / C/C++ / Additional Include Directories, and I added the lib.X86 directory into Project Properties / Linker / Additional Library Directories. I get no errors visible on the file, but when I build I get
1>Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol _DetourTransactionBegin#0 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourTransactionCommit#0 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourUpdateThread#4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourAttach#8 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourDetach#8 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourRestoreAfterWith#0 referenced in function _main
1>C:\Users\colel\source\repos\Project3\Debug\Project3.exe : fatal error LNK1120: 6 unresolved externals
1>Done building project "Project3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========
Which looks like the library wasn't included correctly. How do I properly include the detours library into a visual studio project and what am I doing wrong?
You need to add the specific .lib file, which I'm guessing is "detours.lib" (or similar) to the "Additional Dependencies" line.
Properties->Linker->Input->Additional Dependencies.
I'm trying to run a program with GLFW in C++. I'm using visual studios 2019 on a windows 10 computer. I put the .h's and the .lib's in the proper folders and linked to them in the project settings. I'm running a minimal GLFW program I got off the internet. When I run it I get the following error:
1>------ Build started: Project: Riemannian, Configuration: Debug Win32 ------
1>Main.cpp
1>Main.obj : error LNK2019: unresolved external symbol __imp__glClear#4 referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwCreateWindow referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwWindowShouldClose referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwPollEvents referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwMakeContextCurrent referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function _main
1>C:\Users\Aaron\source\repos\Riemannian\Debug\Riemannian.exe : fatal error LNK1120: 8 unresolved externals
1>Done building project "Riemannian.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I tried adding glfw3.dll to system32, but that didn't change anything. (side note, GLFW came with a file glfw3dll.lib. Is that just a .lib file that serves the same purpose as glfw3.dll?) Next I tried linking to opengl32.lib in my project settings. This got rid of the first error, the one with the __imp__ prefix. After that there were only 7 unresolved external symbols. My project type is "Application (.exe)" if that's relevant. I'm out of ideas and tired of googling, does anyone know what to do?
On a broader note, I have wasted so many hours trying to get libraries to work in Python, Java, and C++. I am incredibly frustrated and I wish someone could just explain to me how libraries work once and for all so that next time I have a problem I won't be completely lost.
If all this setup is too complicated, you can also just take the Glitter project as a base. It takes care of all the boilerplate and just lets you get on with writing OpenGL. As a bonus, it is based on the cross-platform CMake build tool so your project should be easy to port to other operating systems.
I built libcurl and added it to project (specified include directory, library directory and library to use: libcurl.lib/libcurl_imp.lib - I both tried to compile and link static and dynamic library). In both cases (static/dynamic) I faced following:
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_cleanup referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_perform referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_setopt referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>tmp.obj : error LNK2019: unresolved external symbol _curl_easy_init referenced in function "void __cdecl perform(char *)" (?perform##YAXPAD#Z)
1>C:\Users\Public\Documents\Project\curl-7.35.0\Debug\tmp.exe : fatal error LNK1120: 4 unresolved externals
All solutions I found was different variations of "add libcurl.lib".
Now just to clarify my configuration:
dynamic: include directory specified, library directory specified, libcurl_imp.lib specified as additional dependency, libcurl.dll copied to the directory where executable files should be generated.
static: include directory specified, library directory specified, libcurl.lib specified as additional dependency.
using vs2005
Well, it's silly but I was trying to use x64 library in x32 project.
I am having problem figure out how to use libusb, I put "libusb-1.0.18-rc1\libusb"
in include directories (using Visua Studio), but it doesn't work.
Can anyone enlighten me. Thanks a lot!
error message:
1>test.obj : error LNK2019: unresolved external symbol _libusb_exit#4 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_close#4 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_release_interface#8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_bulk_transfer#24 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_claim_interface#8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_detach_kernel_driver#8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_kernel_driver_active#8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_free_device_list#8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_open_device_with_vid_pid#12 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_get_device_list#8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_set_debug#8 referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _libusb_init#4 referenced in function _main
If you havne't done so already you will need to build the libraries you will be linking to, they are located in \libusb-1.0.18-rc1\msvc. There are multiple projects there depending on your Visual Studio version and whether you want a DLL or a static LIB file.
In either case you will need to right click on your project, then under Configuration Properties -> Linker -> Input -> Additional Dependencies add a reference to the LIB file you created. If you are linking to the static LIB file you're done, it will build the code in to your executable. If you're linking to the LIB file for the DLL make sure the DLL is available in your execution path. In either case this should resolve your unresolved externals.
I think you must take the 32-Bit Version of the libusb-Library/DLL and ensure 32 Bit Compile at Project Properies. That solved my Problem with LNK2019.
I've been trying to use the CUDA driver API to load a .ptx file and a function from it with this code:
CUdevice device;
cuDeviceGet(&device,0);
CUcontext ctx;
cuCtxCreate(&ctx,0,device);
CUmodule mod;
cuModuleLoad(&mod,"kernel.ptx");
CUfunction func;
cuModuleGetFunction(&func,mod,"kernel");
CUdeviceptr ints;
cuMemAlloc(&ints,(sizeof(int)*30));
However at compile time I get these errors:
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuDeviceGet#8 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuCtxCreate_v2#12 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuModuleLoad#8 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuModuleGetFunction#12 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuMemAlloc_v2#8 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuMemcpyHtoD_v2#12 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuMemcpyDtoH_v2#12 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cuLaunchKernel#44 referenced in function _main
I created a new CUDA 5.5 project in VS2012 and typed this directly into the generated .cu file however at compile time I got these errors. If I do a test that doesn't use the driver api I don't get any errors!
Those errors occur when you are not linking against cuda.lib.
For those who does not know how to add cuda.lib into linking process like me (using VS2017):
Right click on the project, goto Properties at the bottom of the menu
Goto Linker-->Input
In Additional Dependencies, make sure that cuda.lib is there. In my case, this solved the 2019 link error.
Besides, if you click on the edit item in the drop menu, there is a Macros button that you can click and view all pre-defined Macros in your VS project.