Page 1 of 1

Tutorial Intermediate 14 Fail to Build

Posted: January 15th, 2018, 5:16 pm
by jamesmfox
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

Re: Tutorial Intermediate 14 Fail to Build

Posted: January 15th, 2018, 6:42 pm
by albinopapa

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.

Re: Tutorial Intermediate 14 Fail to Build

Posted: January 15th, 2018, 7:14 pm
by jamesmfox
Thank you! That solved the problem.