Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler errors on Box example #26

Open
velik97 opened this issue Jan 3, 2021 · 6 comments
Open

Compiler errors on Box example #26

velik97 opened this issue Jan 3, 2021 · 6 comments

Comments

@velik97
Copy link

velik97 commented Jan 3, 2021

Got a lot of compiler errors when trying to debug Box example from Chapter 6
Started from empty C++ project for Windows, VS 2019

Build started...
1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>BoxApp.cpp
1>E:\Documents\Test\BoxApp.cpp(197): error C2102: '&' requires l-value
1>E:\Documents\Test\BoxApp.cpp(204): error C2102: '&' requires l-value
1>E:\Documents\Test\BoxApp.cpp(205): error C2102: '&' requires l-value
1>E:\Documents\Test\BoxApp.cpp(189): error C2102: '&' requires l-value
1>E:\Documents\Test\BoxApp.cpp(215): error C2102: '&' requires l-value
1>d3dApp.cpp
1>E:\Documents\Test\Common\d3dApp.cpp(199): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\d3dApp.cpp(216): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\d3dApp.cpp(547,77): error C2664: 'HANDLE CreateEventExW(LPSECURITY_ATTRIBUTES,LPCWSTR,DWORD,DWORD)': cannot convert argument 2 from 'bool' to 'LPCWSTR'
1>E:\Documents\Test\Common\d3dApp.cpp(547,47): message : Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\synchapi.h(647,1): message : see declaration of 'CreateEventExW'
1>d3dUtil.cpp
1>E:\Documents\Test\Common\d3dUtil.cpp(30,5): warning C4244: 'argument': conversion from 'std::streamoff' to 'SIZE_T', possible loss of data
1>E:\Documents\Test\Common\d3dUtil.cpp(48): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\d3dUtil.cpp(58): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\d3dUtil.cpp(70,32): warning C4244: '=': conversion from 'UINT64' to 'LONG_PTR', possible loss of data
1>E:\Documents\Test\Common\d3dUtil.cpp(76): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\d3dUtil.cpp(79): error C2102: '&' requires l-value
1>DDSTextureLoader.cpp
1>E:\Documents\Test\Common\DDSTextureLoader.cpp(1273): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\DDSTextureLoader.cpp(1292): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\DDSTextureLoader.cpp(1294): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\DDSTextureLoader.cpp(1305): error C2102: '&' requires l-value
1>E:\Documents\Test\Common\DDSTextureLoader.cpp(1311): error C2102: '&' requires l-value
1>MathHelper.cpp
1>Generating Code...
1>Done building project "Test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

@JoeSwindell
Copy link

Your build settings are wrong, look at the build settings in one of the existing settings and see what's different.

I believe offhand you need to switch at least your character set.

https://docs.microsoft.com/en-us/cpp/build/working-with-project-properties?view=msvc-160

@Sere-Fu
Copy link

Sere-Fu commented Jan 7, 2021

I went into exactly the same problem, win10, vs2019. same procedures as indicated in the book.

@ericschwarzkopf
Copy link

This is caused by the c++ standard conformance check that is active in vs2019 (see https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-160). If you set the corresponding flag in the project settings to /permissive, the errors go away.

@AriaMoKr
Copy link

AriaMoKr commented Jul 2, 2021

To add to @ericschwarzkopf in the Property Pages, Configuration Properties -> C/C++ -> Language -> Conformance mode: change from Yes (/permissive-) to No (/permissive)

@tadashi90
Copy link

@AriaMoKr solution works. This should be closed.

@Wunjo777
Copy link

@AriaMoKr Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants