错误 LNK2019:未解析的外部符号 _WinMain@16 在函数 ___tmainCRTStartup 中引用 [英] error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

查看:36
本文介绍了错误 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 中引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆