I KEEP GETTING THESE TWO ERRORS:
1. error C2011: 'vehicle' : 'class' type redefinition
2.see declaration of 'vehicle'

#include <iostream>
#include <string>
#include "vehicle_imp.h"

//IMPLEMENTATION
vehicle::vehicle()
{
 x = 0;
 y = 0;
speed = 0;
facing = 0;
}

void vehicle::turn(int facing)
{
	facing=facing+90;

	if(facing==360)
	{
		facing=0;
	}
}

void vehicle::accelerate(int vel)
{
	speed = speed + vel;

	if (speed < 0) speed = 0;     
	if (speed > 200) speed = 200; 
}

void vehicle::move()
{
	if(facing==0)
	{ x=x+speed;}
	else if(facing==90)
	{y=y+speed;}
	else if(facing==180)
	{x=x-speed;}
	else if(facing==270)
	{y=y-speed;}
}

//SPECIFICATION
#include <iostream>
#include <string>

using namespace std;

class vehicle
{
public:
	vehicle();
	void turn(int facing);
	void accelerate(int speed);
	void move();

private:
	int facing;
	int speed;
	int x;
	int y;
};

//MAIN CPP FILE 
#include <iostream>
#include <string>
#include "vehicle.h"
#include "vehicle_imp.h"

using namespace std;

int main()
{
return 0;
}
#include "vehicle.h"
#include "vehicle_imp.h"

One or both those header files define the vehicle class.

In your MAIN CPP FILE, you only need to include the declaration header file (.h) for your vehicle. That is sufficient for you to use the 'vehicle' class. You do not have to include the implemenation file (.cpp) in your main file. The compiler is smart enough to find the implementaions for the 'vehicle' class.

However, do remember to include the declaration header file in your implementation file.

it could also be because you have #include <iostream> and the other #include one being declared multiple times....hust declare the #include stuff in your header file and then include your header file in your main.cpp and in your class file

That is what the issue is. Multiple #includes on standard headers aren't a problem, its the the multiple #includes on the custom "vehicle" headers that is the problem. The OP either needs to add header guards or change their inclusion structure to eliminate the redundancies.

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.