microsoft / Windows-appsample-photo-editor

Photo Editor is a UWP photo viewing and editing sample that highlights development with C++/WinRT.
MIT License
182 stars 63 forks source link

Compile error #3

Open techjogger opened 5 years ago

techjogger commented 5 years ago

I am getting this error using VS 2017 15.8.4

Severity Code Description Project File Line Suppression State Error C3861 'from_abi': identifier not found PhotoEditor c:\program files (x86)\windows kits\10\include\10.0.17134.0\cppwinrt\winrt\base.h 2185

I have the C++/WinRT Visual Studio extension( version 1.0.180724.3) installed and base.h is located in the proper location on my hard drive.

Swifter commented 5 years ago

This is a known issue fixed in Windows Insider versions of C++/WinRT, but for now you can apply the following workaround which worked for me.

Modify the compiler options. In Visual Studio Solution Explorer, right-click on the Project file and launch the Properties window. Expand the C/C++ branch and go to the Language node. The second entry from the top is Conformance mode. Set this to Yes (/permissive-). Then select the Command Line node. At the bottom of the window, you'll see a textbox for Additional Options. Add /Zc:twoPhase- and then press the Apply button. Rebuild the project. It should now work fine.

Below are some references for you to view regarding this issue.

https://stackoverflow.com/questions/51066729/c-winrt-part-of-windows-sdk-17134-is-not-compatible-with-visual-studio-15-8-p

https://developercommunity.visualstudio.com/content/problem/297504/all-cppwinrt-code-fails-to-build-from-abi-and-to-a.html

https://kennykerr.ca/2018/08/15/compilers-and-conformance/

JoshuaPartlow commented 5 years ago

Hi, @techjogger thanks for checking out the sample. The issue you're hitting is a known one and is documented, with other frequent issues, in the docs here. Those docs suggest the following as a solution: Set project property C/C++ > Language > Conformance mode: No (also, if /permissive- appears in project property C/C++ > Language > Command Line under Additional Options, then delete it). Please let us know if that corrects the build error.

techjogger commented 5 years ago

Hey @JoshuaPartlow , Thanks for the help! Deleting "/permissive-" from "additional options" solved the build error.