microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
8k stars 1.66k forks source link

building on Win 10 64, vs2015. cpprest140d_2_9.dll is not a valid Win32 application. #328

Closed rwebber closed 7 years ago

rwebber commented 7 years ago

trying to build on win 10 64 in vs 2015. My debug build succeeds, 0 failed, 0 up-to-date, 0 skipped but a dialog pops up. "Unable to start program." ..."cpprest140d_2_9.dll is not a valid Win32 application." I have been following the basic instructions here: https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Windows.

What does this mean?

rwebber commented 7 years ago

I get similar messages building for each target (win32, x86, x64). Additionally trying to build the Tests fails with many errors.

rwebber commented 7 years ago

I have no problem using the nuget install, but I want to include cpprestsdk into a project build using another framework (Juce). For this reason it would be best for me to build and link it. The wiki how to doesn't cover any of the linking etc after the build, so thats likely to be a hanging point as well.

ras0219-msft commented 7 years ago

It sounds like you are trying to run the DLL project and the operating system is informing you that cpprest140d_2_9.dll isn't an executable -- this is the expected behavior. You probably were hitting "f5" or the Run button instead of just Build.

Since the build was fine, then you should simply need to add the .lib to your project's AdditionalDependencies and the Release\include directory to your project's Additional Include Directories. You will also need to copy the .dll to your output folder so that the operating system can find it when your executable runs.

I also recommend looking at Vcpkg; this is our latest project to help acquiring C++ libraries on Windows. We don't have Juce yet unfortunately, but we do have over 140 other libraries including cpprestsdk, boost, azure-storage-cpp, and aws-cpp.

[1] https://github.com/Microsoft/vcpkg

rwebber commented 7 years ago

Thank-you. vcpkg is amazing! I would love to see it include 'everything' ;)