Common issues

The Partridge Family were neither partridges nor a family. Discuss.
albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Common issues

Post by albinopapa » December 17th, 2020, 7:11 am

With the 2016 tutorial series, I've really only come across one common issue and that's in the FartAnnoyed tutorials. In this series, chili initializes a RectF structure by calling one constructor from another. The common issue among first time watchers is missing the placement of the call, see below.

Most seen incorrect code on forum from this series

Code: Select all

RectF::RectF(const Vec2 & topLeft, const Vec2 & bottomRight)
{
	RectF(topLeft.x, bottomRight.x, topLeft.y, bottomRight.y);
}

RectF::RectF(const Vec2 & topLeft, float width, float height)
{
	RectF(topLeft, topLeft + Vec2(width, height));
}
The code is meant to forward the values to the RectF constructor taking four floats, but is actually happening is that constructor is being called to create a temporary and then deleted because it isn't being assigned to anything. The correct version should be:

Code: Select all

RectF::RectF( Vec2 & topleft, Vec2 & bottomright )
	:
RectF( topleft.x, bottomright.x, topleft.y, bottomright.y )
{
}

RectF::RectF( Vec2 & topleft, float height, float width ) 
	:
RectF( topleft, topleft + Vec2( width, height ) )
{
}
You should notice that the call to the next constructor happens after : and before { }. This space is called the class initializer list. This is used to initialize data members of the class. The { } portion of the constructor is the function body which is like any other function body other than not being able to return values.
Last edited by albinopapa on December 17th, 2020, 7:12 am, edited 1 time in total.
Reason: made sticky
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

Alexderoode01
Posts: 1
Joined: December 19th, 2020, 9:22 pm

Re: Common issues

Post by Alexderoode01 » December 19th, 2020, 9:43 pm

Hey guys,
I am totally new to programming in C++ and wanted to start my first lesson.
I downloaded the 2017 version of Visual Studio and did it according to the video Chili made about Visual Studio 2017.
For some reason I could not choose to open the app as seen in the video. It didn't show me the development settings. And therefore I couldn't choose C++. I dunno whether this has to do with the issue I am about to describe, I decided to include it anyway in the hope it could help.

So the issue starts when I head to the 2016 framework folder, and try to open the open the file. it opens it in Visual Studio 2017 and then I get the error that "one or more files/solutions couldn't be loaded" or something. This is what my output gives me: "C:\Users\Alexd\AppData\Local\Temp\Temp1_Chili DirectX Framework (2).zip\Chili Framework 2016\Engine\Engine.vcxproj : error : Project "C:\Users\Alexd\AppData\Local\Temp\Temp1_Chili DirectX Framework (2).zip\Chili Framework 2016\Engine\Engine.vcxproj" could not be found."

Now I am also getting this: message on an error prompt: Visual C++ found a suitable location to store its browsing database and IntelliSense files for the solution "C:\Users\Alexd\AppData\Local\Temp\Temp1_Chili DirectX Framework (2).zip\Chili Framework 2016\.vs\Chili Framework 2016\v15\Browse.VC.db."

Visual C++ examined the folder "C:\Users\Alexd\AppData\Local\Temp\Temp1_Chili DirectX Framework (2).zip\Chili Framework 2016\.vs\Chili Framework 2016\v15." This folder is not suitable because of the following:
The browsing database in this directory is open by another instance of Visual Studio and cannot be reopened. User Alexd on DESKTOP-NSIC64Q has it open.

Because a 'Fallback Location' was not specified in the C++ Advanced Options, Visual C++ is attempting to use your temporary directory.

Visual C++ examined the folder "C:\Users\Alexd\AppData\Local\Temp\VC++\BROWSE.VC-ffb2ebe1." This folder is suitable because of the following:
The directory is on a local drive.

The 'Fallback Location' is configurable under C++ Advanced Options.

Press OK to use this location.
Press Cancel to disable C++ browsing information and IntelliSense for this session."

Anyways, I have absolutely no idea what I did wrong, and how I can fix it.
If any of you guys could help a clueless beginner out, it would be appreciated quite a lot!
Thanks in advance!

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Common issues

Post by albinopapa » January 4th, 2021, 6:52 am

I know this is a little late, but it seems like in one case you are trying to open the solution/project without actually extracting the ZIP file to a folder. The second part of the errors happen if you try opening the same solution more than once say from two instances of VS.

If this is the case, extract the files from the framework to a folder of their own:
C:\Source\Chili Framework 2016 for instance and make sure when you double click on the .sln file you only have one instance of VS open.
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

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Common issues

Post by chili » January 5th, 2021, 12:03 pm

There a funky one in the final project for Intermediate. It seems like box2d crew went and make a breaking change to the code, and it screws up the collision at the boundaries of the field. the boxes fly out and trigger an out-of-screen putpixel exception. At least, this is my surmise. I haven't cloned it lately and tried to build it myself. I'd have to pull the latest b2d via vcpkg as well... :[
Chili

hey
Posts: 5
Joined: December 13th, 2021, 8:58 pm

Re: Common issues

Post by hey » December 30th, 2021, 8:19 am

My issue is with the T16 video in Beginner C++ Game Programming. First I cloned the poo game from Github and then created a new branch. When I opened Game.cpp to start programming I had an error about VK_RETURN. After that I opened Graphics.cpp and I found 88 errors about assert.h and other stuff I don't understand. I would really appreciate it if anyone could tell me what I might have done wrong, thanks:)
nenuytnfyuntfe

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Common issues

Post by albinopapa » January 3rd, 2022, 5:08 am

It sounds like it's missing some of the macros telling Visual Studio where to find the Windows SDK files. You may need to reinstall Visual Studio making sure to have the correct options ( C++ Desktop development ) in the Visual Studio installer.
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

hey
Posts: 5
Joined: December 13th, 2021, 8:58 pm

Re: Common issues

Post by hey » January 3rd, 2022, 8:33 am

Thank you, I will try reinstalling visual studio and tell you if it works.
Edit: I repaired it and now I have no errors, thank you for the help
nenuytnfyuntfe

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Common issues

Post by albinopapa » January 3rd, 2022, 7:14 pm

Good deal, glad it worked out.
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

hey
Posts: 5
Joined: December 13th, 2021, 8:58 pm

Re: Common issues

Post by hey » January 4th, 2022, 6:38 pm

I have the errors back again. After finishing tutorial 13, I made a new branch at the T16 Start to start programming, and the errors returned. Then I reinstalled (no restarting this time) vs 2022 and ticked the boxes like the video, but the thing is that there are things that chili ticked that I don't have and there are stuff that I have ticked that chili doesn't have. After the installation I had the same errors. Should I just download vs 2015?
nenuytnfyuntfe

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Common issues

Post by albinopapa » January 4th, 2022, 10:37 pm

Maybe.

You could also try uninstalling, then reinstalling. I know the videos start with VS2015, but later move to VS 2017 and I can't remember if the tutorials use any features that aren't available in VS2015. I know if you follow the "STD Gems" videos you'll need at least VS2017, so maybe at least that if you are wanting to follow all the videos.
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

Post Reply