LNK2019 nicht aufgelöstes externes Symbol Verknüpfung Ausfall _main in Funktion referenziert "int __cdecl invoke_main (void)" (? Invoke_main @@ YAHXZ)eines Programms mit Templat-Haupt
ich mein Programm zusammenstellen können, kann aber Mach es nicht. Es ist eine Windows-Konsole-Anwendung, und es ist so in Linker -> System -> SubSystem
festgelegt.
#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;
}
Sie haben Recht. Ich habe es entfernt und es hat funktioniert. Vielen Dank! –