error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup(错误 LNK2019:未解析的外部符号 _WinMain@16 在函数 ___tmainCRTStartup 中引用)
问题描述
当我运行下面的简单代码时,我有两个错误如下:
While I am running the simple code as below I have two errors as following:
#include <iostream>
#include <string>
using namespace::std;
template <class Type>
class Stack
{
public:
Stack (int max):stack(new Type[max]), top(-1), maxsize(max){}
~Stack (void) {delete []stack;}
void Push (Type &val);
void Pop (void) {if (top>=0) --top;}
Type& Top (void) {return stack[top];}
//friend ostream& operator<< (ostream&, Stack&);
private:
Type *stack;
int top;
const int maxSize;
};
template <class Type>
void Stack <Type>:: Push (Type &val)
{
if (top+1<maxsize)
stack [++top]=val;
}
错误:
MSVCRTD.lib(crtexew.obj) : error LNK2019: 未解析的外部符号 _WinMain@16
引用在函数 ___tmainCRTStartup
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol
_WinMain@16
referenced in function___tmainCRTStartup
我该怎么办?
推荐答案
那是链接器问题.
尝试更改属性 -> 链接器 -> 系统 -> 子系统(在 Visual Studio 中).
Try to change Properties -> Linker -> System -> SubSystem (in Visual Studio).
从 Windows (/SUBSYSTEM:WINDOWS) 到 控制台 (/SUBSYSTEM:CONSOLE)
这个一个帮了我
这篇关于错误 LNK2019:未解析的外部符号 _WinMain@16 在函数 ___tmainCRTStartup 中引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:错误 LNK2019:未解析的外部符号 _WinMain@16 在函数


- XML Schema 到 C++ 类 2022-01-01
- OpenGL 对象的 RAII 包装器 2021-01-01
- 如何提取 __VA_ARGS__? 2022-01-01
- 将 hdc 内容复制到位图 2022-09-04
- GDB 不显示函数名 2022-01-01
- 将函数的返回值分配给引用 C++? 2022-01-01
- 使用 __stdcall & 调用 DLLVS2013 中的 GetProcAddress() 2021-01-01
- DoEvents 等效于 C++? 2021-01-01
- 哪个更快:if (bool) 或 if(int)? 2022-01-01
- 从父 CMakeLists.txt 覆盖 CMake 中的默认选项(...)值 2021-01-01