Just started the beginner guide to c++ game dev series from 2016.
When trying to compile, VS2017 RC will sometimes (seems totally random) stop at lines 102-111 in colors.h.
The error message is: "function call must have a constant value in a constant expression".
It's like the MakeRGB-function doesn't accept the values given (255u,255u,255u) etc.
Changing line 98 in colors.h (changing the char to int)
static constexpr Color MakeRGB( unsigned char r,unsigned char g,unsigned char b )
to
static constexpr Color MakeRGB( unsigned int r,unsigned int g,unsigned int b )
seems to alleviate the problem, but I don't want to fuck things up.
Any tips on how to get around this without breaking shit?
Trouble compiling in VS2017 RC.
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Trouble compiling in VS2017 RC.
If you keep the line the same:
for the unsigned char values, instead of 255u, change to 255ui8.
The ui8 at the end, means unsigned eight bit int...ie unsigned char.
I didn't have trouble compiling the 2016 framework in VS2017, but intellisense kept saying the values wouldn't fit, but that was because I was trying to pass in a float. That brings me to the next issue, make sure you pass in unsigned chars and not int, unsigned int or float to the MakeRGB or Color constructor.
I'm guessing the standards committee is getting more string about implicit conversions.
Code: Select all
static constexpr Color MakeRGB( unsigned char r,unsigned char g,unsigned char b )
Code: Select all
static constexpr Color Red = MakeRGB(255ui8, 0ui8, 0ui8);
I didn't have trouble compiling the 2016 framework in VS2017, but intellisense kept saying the values wouldn't fit, but that was because I was trying to pass in a float. That brings me to the next issue, make sure you pass in unsigned chars and not int, unsigned int or float to the MakeRGB or Color constructor.
I'm guessing the standards committee is getting more string about implicit conversions.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Trouble compiling in VS2017 RC.
I personally recommend waiting until full release to start using VS2017 in earnest. You can experiment, but if you are still learning C++, adding one more factor to mess things up (an unfinished / potentially buggy environment) isn't going to help matters.
Chili