-2
林已经定义得到这个LNK 2005错误,即使我已经装箱使用正确的头文件和CPP文件格式尽可能IM知道游戏类。C++ LNK 2005错误“的.OBJ
哪个google搜索后一会儿的问题似乎是这种错误的主要原因,任何人都可以看到什么是我搞砸了
我game.h文件如下:?
#pragma once
class Game
{
public:
//Variables
char grid[9][8] = { { '#','#','#','#','#','#','#','#' },
{ '#','G',' ','D','#',' ',' ','#' } ,
{ '#',' ',' ',' ','#',' ',' ','#' } ,
{ '#','#','#',' ','#',' ','D','#' } ,
{ '#',' ',' ',' ','#',' ',' ','#' } ,
{ '#',' ','#','#','#','#',' ','#' } ,
{ '#',' ',' ',' ',' ',' ',' ','#' } ,
{ '#','#','P','#','#','#','#','#' } ,
{ '#','#','#','#','#','#','#','#' } };
int width, height;
int pX;
int pY;
char direction;
bool west;
bool north;
bool south;
bool east;
int quit;
Game();
};
我game.cpp文件:
#include "stdafx.h"
#include <String>
#include <iostream>
#include "Game.h"
using namespace std;
//constructoer
Game::Game()
{
width = 8, height = 8;
pX = 2;
pY = 7;
west = false;
north = true;
south = false;
east = false;
quit = 0;
}
我主要是从字面上就在此刻
主要创建对象的实例:
#include "stdafx.h"
#include <String>
#include <iostream>
#include "Game.cpp"
#include "Game.h"
using namespace std;
int main()
{
Game g;
return 0;
}
你的main()函数在哪里? –
@theRoadToCodeOverload不要在注释中放置代码,但是请编辑您的问题并将该代码放在_there_处。 –
@theRoadToCodeOverload A [MCVE]和逐字错误文本请。 – user0042