Tutorial Intermediate 14 Fail to Build

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
jamesmfox
Posts: 15
Joined: September 1st, 2017, 10:46 pm
Location: Mississippi, USA

Tutorial Intermediate 14 Fail to Build

Post by jamesmfox » January 15th, 2018, 5:16 pm

I was following the youtube video and getting an error

Code: Select all

error C2061: syntax error: identifier 'Graphics' (compiling source file Animation.cpp)
error C2061: syntax error: identifier 'Graphics' (compiling source file Character.cpp)
error C2065: 'gfx': undeclared identifier (compiling source file Character.cpp)
error C2228: left of '.PutPixel' must have class/struct/union (compiling source file Character.cpp)
note: type is 'unknown-type' (compiling source file Character.cpp)
The Code snippet from SpriteEffect.h
Spoiler:

Code: Select all

namespace SpriteEffect
{
	class Chroma
	{
	public:
		Chroma(Color c)
			:
			chroma(c)
		{}
		void operator()(Color cSrc, int xDest, int yDest, Graphics& gfx) const
		{
			if (cSrc != chroma)
			{
				gfx.PutPixel(xDest, yDest, cSrc);
			}
		}
	private:
		Color chroma;
	};
https://github.com/JamesMFox/Sprite/tree/I14-DEV

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

Re: Tutorial Intermediate 14 Fail to Build

Post by albinopapa » January 15th, 2018, 6:42 pm

Code: Select all

// Your Graphics.h file includes
#pragma once
#include "ChiliWin.h"
#include <d3d11.h>
#include <wrl.h>
#include "ChiliException.h"
#include "Colors.h"
#include "Surface.h"
#include "Rect.h"
#include "SpriteEffect.h"
#include <cassert>

// Your SpriteEffect.h includes
#include <cassert>
#include "Graphics.h"
#include "Colors.h"
There is a circular dependency between Graphics.h and SpriteEffect.h. Remove #include SpriteEffect.h from Graphics.h.
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

jamesmfox
Posts: 15
Joined: September 1st, 2017, 10:46 pm
Location: Mississippi, USA

Re: Tutorial Intermediate 14 Fail to Build

Post by jamesmfox » January 15th, 2018, 7:14 pm

Thank you! That solved the problem.

Post Reply