code execution cannot proceed because cpprest_2_10.dll was not found - c++

My aim is to use the Rest API in Visual Studio.
I downloaded the C++ tool vcpkg from https://github.com/Microsoft/vcpkg and followed the instructions on https://github.com/Microsoft/cpprestsdk to install cpprestsdk. That worked fine.
Then, in Visual Studio in the properties of the solution explorer, I included the following paths from the vcpkg folder into "VCC++ Directories->Include directories":
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\cpprest
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\pplx
Then I run my code and the following errors occur:
LNK2001 unresolved external symbols (32 errors like this)
I googled it and was told to include the respective ".lib"-files into "Properties->Linker->Input->Additional Dependencies" and to include the paths of the corresponding ".dll"-files into "Properties->Linker->General->Additional Library Directories", what I did.
Now, running the code again, just the following error occurs:
code execution cannot proceed because cpprest_2_10.dll was not found. Reinstalling the program may fix the problem,
although the "cpprest_2_10.dll" is in the path, which I included previously.
I have no idea what the problem is. Thank you in advance for your time.

Try to put the missing dll file right to the directory of your compiled exe.
Or check this answer to set a path so your binary can find the dll file:
How do I set the path to a DLL file in Visual Studio?

Related

C++ detours linking issue

I have problems building my code that is using static lib detours. I am trying to do an old basic CTF. For that I want to get into detours.
Whenever I try to build my .dll file I get an issue
LNK2019 unresolved external symbol _DetourTransactionBegin#0 referenced in function _DllMain#12
Now, I have built the detours library using 3 different version of the visual studio dev console.
I have tried firing 'vcvars32.bat' and then using nmake to build the library which was able to build it, but I get the above error during linking my .dll. I have also tried building it with 'vcvarsamd64_x86.bat' and then using nmake to build it which also was able to build the library, but I still get the same error as above during linking.
I have tried the usual stuff: the include folder for detours.h is added to C++/General/Additional Include Directories.
Under Linker/Additional Library Directories I added them as follows: "C:\temp\det_retry\lib.X64";"C:\temp\det_retry\lib.X86";%(AdditionalLibraryDirectories).
And also under Linker/Input/Additional Dependencies I have the following: detours.lib;%(AdditionalDependencies)
What am I missing here? This is a blocker for me for a couple of days and I am reiterating the same steps trying to figure out what's missing but I cannot see. I'd really appreciate the input.
I am sure I am using the newest version because I have downloaded (cloned) detours from the ms github page.
It appears your "Additional Library Directories" are setup incorrectly or contain invalid entries rather. They look like actual library file entries (i.e. pointing to some specific files) versus being only directories (e.g. "my/lib/path/for/my_project/"). Visual Studio's naming conventions are somewhat cryptic but they should be directory entries only. There should be an entry to whatever directory contains the detours.lib file (e.g. "MyProject/Libs/MSDetour" ... where MSDetour is a folder with the "detours.lib" in it) and then Visual Studio should find the library and link everything correctly.
As a side note, if you are using the Visual Studio developer console for building your project/solution you might want to look into CMake ... it is, in my opinion, significantly easier to work with (less "settings" digging) and maintain in the long-run.

Zbar in CPP Project libiconv.lib not found

Hello I try to integrate Zbar 64bit version into my visual studio cpp project. I downloaded the build from https://github.com/NaturalHistoryMuseum/ZBarWin64 and I set up my IncludePath to both include and \zbar\include also included both libs lib + zbar\lib-64. The linker was also set to 64 version but now I'm getting an error.
The code execution cannot proceed because libiconv.dll was not found. Reinstalling the program may fix this problem.
I already set the linker and lib path to the folder where the dll is. But still getting the error.
Any suggestions?
Kind regards
Max
Added ZBarWin64-master\zbar\libiconv to system variables PATH.
Added ZBarWin64-master\zbar\libiconv\dll_x64 to system variables PATH.
Don't know what fixed it, but now it is running like a charm :)

Linking libpqxx from Visual Studio 2015 on Windows 10

I've recently decided to try out PostgreSQL as the database platform for some C++ development I'm working on. I decided to use libpqxx as the connection library for my project, and quickly found out this would be an uphill battle to do from VS 2015 on a Windows 10 machine.
After much teeth-gnashing and nail-biting, I have gotten libpqxx to compile on Windows 10.
This leaves me with the following directory structure
Per libpqxx's documentation, I also placed a copy of libpq.dll in my project's executable directory. Please note: I have done this for both debug and release builds, tried to build both, and ended up with the same result.
All the tutorials I've seen seem to indicate that the library can be used after linking it and simply #including pqxx/pqxx, so I set up a small project to do just that. I receive the error:
fatal error C1083: Cannot open include file: 'pqxx/pqxx': No such file or directory
When attempting to build the project. I have also tried this will both debug and release builds, to no avail.
Here is a screenshot of my linker settings.
Does anyone have any suggestions for how I might be able to link and use this library from Visual Studio 2015?
As Sami Kuhmonen pointed out, this was not actually a linker error, but a compiler error. I needed to include an actual header, which Visual Studio needed to be able to find. After adding the correct folder (C:\libpqxx\include in my case) to Visual Studio's "additional include directories" setting under C\C++ -> General per drescherjm's suggestion, the program compiles just fine.
For future reference:
I did also run into unresolved external linker errors after solving the initial issue. This is because you need to make sure to also link to ws2_32.lib and libpq.lib. You also need to copy some other DLL files that libpq also relies on into your libpqxx lib folder. On my system, I believe these were ssleay32.dll, libeay32.dll, and libintl-8.dll. These files reside under the root of the PostgreSQL install. The DLL step is mentioned under libpqxx's INSTALL.txt file, however I believe it stated that the DLLs resided one folder under where I actually found them.
I have also faced same issue. Then I realized that I was building ,my application as a 32bit. I changed the target to x64 and it compiled successfully

CMake And Visual Studio build errors

I've been trying to compile tulip using cmake to generate visual studio 2012 project files. It's giving me lots of trouble. I don't know how to get this to build. I've been trying to get visual studio to build this for 4 days now, and I'm extremely frustrated. Essentially, I follow the steps here, and then set the variables CMAKE_LIBRARY_PATH AND CMAKE_INCLUDE_PATH according to these instructions.
To get to where I'm at, all you have to do is download tulip, and:
Unzip it, create a separate build directory outside of this source directory
Open CMake-gui to the source and build directories
Hit configure. Check use qt5, tell it where qmake is (make sure it's qt5)
You need some dependencies as described in The Independent CMake tutorial. Grab all those dependencies
As you continue to hit configure, specify each of the directories that it asks for as it errors out. It should ask for freetype, glew, zlib and sphinx. It shouldn't ask for where libxml or libpng, or libjpeg are. I don't know why it doesn't ask for those.
Generate, and then browse to the ALL_BUILD that you've generated. Open it with visual studio
try to build it with visual studio.
In those instructions and in the process of getting CMake to generate the visual studio build files, it specifically asks for freetype's location. But in my build, it doesn't have a clue how to link the freetype library.
Here are the errors that I get
Here is my CMakeCached.txt
I know that many people aren't going to want to exactly try and go about replicating the build environment, so I've uploaded my build directory to dropbox. You can pull the entire thing down, and then open it in cmake gui and open the visual studio files in there too.
https://www.dropbox.com/sh/qsvukh9t5gb6bvt/tOfOBxWgd0
The linker errors you point to (mostly "unresolved external" errors) indicate that there are missing libraries on the link command line.
That is most likely happening because target_link_libraries calls in the tulip project are either being skipped or being called with library names that do not match the library names on disk.
Open up the solution in Visual Studio and right click the project and choose "Properties" -- look at the "Linker > Input" panel at the "Additional Dependencies" field. That should list all the libraries it wants to link to. Is there a freetype library listed there? Does that library exist in the referenced location on your disk?
There could be a mistake in the tulip project, or there could just be something wrong with your build/install of freetype...
UPDATE AFTER SOME CHAT:
Or it may be that you have some libraries built for x86 and some for x64... or maybe some for Debug and some for Release... or maybe even some with the MinGW compiler and some with the Visual Studio compiler. If that's the case, start over, from a clean slate, and build everything with a consistent compiler, configuration type and architecture. Then report back again with an update and see if the problems still remain.
I do with Dave,
You should try to fix your error 1 by 1.
The first error seems to be a link error:
Error 1 error LNK2019: unresolved external symbol gzread referenced in function "public: virtual int __cdecl gzstreambuf::underflow(void)" (?underflow#gzstreambuf##UEAAHXZ) C:\Users\kenne_000\tulip-build\tulip-build-debug\thirdparty\gzstream\gzstream.obj gzstream
gzstream is a third party lib included with tulip source in:
thirdparty\gzstream
from
thirdparty\gzstream\CMakeLists.txt
you can see that the missing symbols should be coming from ZLIB.
However your CMakeCache.txt indicate that
ZLIB_LIBRARY:FILEPATH=C:/Users/kenne_000/dependencies/zlib128-dll/lib/zdll.lib
is found.
So the question may be, was this dependency compiled with the same compiler?
Don't you have compiler-specific name mangling issue ?

Visual Studio 2010 Assimp library won't link

I seem to have a perpetual problem of never being able to get any library to link with Visual Studio. Ever. I eventually get tired of trying and just include the header and source files manually.
My latest endeavour is trying to set up Assimp. I went and downloaded the latest version and followed the installation guide for Visual Studio 2010. http://assimp.sourceforge.net/lib_html/install.html
The result:
LINK : fatal error LNK1104: cannot open file 'assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib'
I set the include directories:
assimp--3.0.1270-sdk/include
I set the library directories:
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64
I set the additional dependencies (the guide includes the directories, but shouldn't I just be able to just put assimp.lib since I included the library directory above?):
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib
What am I doing wrong?
Also, considering this isn't my first time having these difficulties, are there any good tutorials to help me understand this process a little better? I've tried searching for it but most are for previous versions of VS...
My guess is you should provide explicitly relative or absolute paths for the library directory.
You're right about the dependency name, assimp.lib is the correct name and the guide is a bit ambiguous here.
Apart from that, you're doing everything right. Provided the lib file exists, it should link.
(assimp co-founder writing here)