我删除了_tmain()
IDE 生成的方法,因为在添加条目后我发现有两个入口点毫无意义WinMain
。是的,这是我的第一个 C++ 应用程序,我是新手,但请善待。
所以这就是我所得到的:
// Included headers:
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
// Shortened namespaces:
using namespace std;
// The main entry of the application:
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
MessageBox( NULL, L"Hello World!", L"Just another Hello World program!", MB_ICONEXCLAMATION | MB_OK );
return 0;
}
// End of file.
当我尝试构建和运行时,我收到此错误:
错误 LNK2019:未解析的外部符号 _main 在函数 ___tmainCRTStartup 中引用
错误 LNK1120:1 未解决的外部
我意识到缺少入口点,但是我可以在哪里设置WinMain
入口点?我只是查看了项目本身的属性,没有发现任何东西。请注意,我已将项目作为控制台应用程序启动,但现在我正试图将其转换为常规 Windows 应用程序。
谢谢。