-2
LNK2019解析的外部符号链接程序的失败与_main函数引用 “INT __cdecl invoke_main(无效)”(?invoke_main @@ YAHXZ)模板主要
我可以编译我的程序,但可不运行它。这是一个Windows控制台应用程序,它在Linker -> System -> SubSystem
中设置。
#include "stdafx.h"
#include <iostream>
#include <queue>
#include "puzzle.h"
#include "state.h"
#include <vector>
using namespace std;
template <typename Puzzle, typename State>
int main()
{
Puzzle puzzle8;
State goalState = new State();
State currentState = new State();
//goal state
goalState.board = { { 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 0 } };
//start state
currentState.board = { { 8, 2, 1 },
{ 5, 6, 0 },
{ 3, 7, 4 } };
puzzle8.visited.push_back(currentState); //add to visited
while (!isGoalState(currentState, goalState))
{
int f, best;
int board1Cost, board2Cost, board3Cost, board4Cost;
vector<State> newStates = expand(currentState);
int bestState = getLowestCost(newStates);
currentState = newStates.at(bestState).board;
cout << "New State found:" << endl;
printState(currentState);
puzzle8.visited.push_back(currentState);
}
return 0;
}
你是对的。我删除它,它的工作。谢谢! –