Common issues

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
albinopapa
Posts: 4311
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: 4311
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: 3945
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

Post Reply