问题描述
我一直在寻找解决方案,并且遇到了这个问题: https://stackoverflow.com/a/12574400/13991027 我遵循了步骤,但似乎仍然无法正常工作。
我过去使用VS进行过项目,这是我第一次遇到此错误。我的代码很短,所以我认为这不是代码错误。 main.cpp:
#include <iostream>
#include "menu.h"
int main()
{
int mode = menu();// 1 == easy,2 == medium,3 == hard
}
menu.h:
#ifndef MENU_H
#define MENU_H
int menu();
#endif
menu.cpp
#include <iostream>
int menu()
{
// Store user input in mode choice
std::string modeChoice;
std::cout << "Please select one of the following to begin:\n";
std::cout << "-Easy\n -Medium\n -Hard\n";
// Check for correct input
do
{
std::cout << "Enter a difficulty here:";
std::cin >> modeChoice;
for (int i = 0; i < modeChoice.length(); i++)
{
if (modeChoice[i] >= 'A' && modeChoice[i] <= 'Z')
{
modeChoice[i] += 32;
}
}
} while (modeChoice != "easy" || modeChoice != "medium" || modeChoice != "hard");
if (modeChoice == "easy")
{
return 1;
}
else if (modeChoice == "medium")
{
return 2;
}
else
{
return 3;
}
}
这是“输出”标签:
1>------ Build started: Project: project,Configuration: Debug Win32 ------
1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>C:\Users\bobb\Desktop\hangman\Debug\project.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "project.vcxproj" -- FAILED.
========== Build: 0 succeeded,1 failed,0 up-to-date,0 skipped ==========
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)