I'm trying to do some inheritance/polymorphism, and so I'm making a parent class.
This is in the header.

class CProtoType
{
public:
	CProtoType(){};	
	virtual ~CProtoType(){};

	virtual CString field1();
	virtual CString field2();
	virtual CString field3();
	virtual CString field4();
	virtual CString field5();
};

And this is the source:

#include "CProtoType.h"



CString CProtoType::field1()
{
	
	return("Hello World!");
}

CString CProtoType::field2()
{

	return("Field2");
}


CString CProtoType::field3()
{

	return("Field3");
}


CString CProtoType::field4()
{

	return("Field4");
}

CString CProtoType::field5()
{

	return("Field5");
}

These are part of a larger existing file, but when I try to compile the .cpp for it, I get the following error:

fatal error C1010: unexpected end of file while looking for precompiled header directive

And it ends up looking at the last bracket. Why doesn't this simple setup work?

Recommended Answers

All 2 Replies

you must include stdafx.h before any other header files in the *.cpp file(s) -- or turn off precompiled heaters.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.