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

查看:318
本文介绍了错误LNK2019:未解析的外部符号_WinMain @ 16在函数___tmainCRTStartup中引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行下面的简单代码,我有两个错误如下:

  #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;}
类型& Top(void){return stack [top];}
// friend ostream&运算符<< (ostream& amp; Stack&);
private:
类型* stack;
int top;
const int maxSize;
};

template< class Type>
void Stack< Type> :: Push(Type& val)
{
if(top + 1< maxsize)
stack [++ top]
}

错误:



< >

MSVCRTD.lib(crtexew.obj):错误LNK2019:在函数中引用的未解析的外部符号 _WinMain @ 16 ___ tmainCRTStartup


我该怎么办?

解决方案

这是一个链接器问题。



尝试更改属性 - >链接器 - >系统 - > SubSystem(在Visual Studio中)从Windows(/ SUBSYSTEM:WINDOWS)到控制台(/ SUBSYSTEM:CONSOLE)



$ b b

这个一个帮助我


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;
}

Errors:

MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

What Should I do?

解决方案

Thats a linker problem.

Try to change Properties -> Linker -> System -> SubSystem (in Visual Studio).

from Windows (/SUBSYSTEM:WINDOWS) to Console (/SUBSYSTEM:CONSOLE)

This one helped me

这篇关于错误LNK2019:未解析的外部符号_WinMain @ 16在函数___tmainCRTStartup中引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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