小编NAI*_*IEM的帖子

错误LNK2019:函数___tmainCRTStartup中引用的未解析的外部符号_WinMain @ 16

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

#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;
}
Run Code Online (Sandbox Code Playgroud)

错误:

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

我该怎么办?

c++ visual-studio visual-c++

135
推荐指数
8
解决办法
22万
查看次数

C++,Error,Native'已退出,代码为-1073741819(0xc0000005)

我在C++中编写了一个程序,但是在调试中我遇到了一个问题,如果你能帮我解决这个代码,我会很高兴,代码的来源和错误已在下面声明:

错误是:

Unhandled exception at 0x011019d6 in 33.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
Run Code Online (Sandbox Code Playgroud)

守则是:

#include <iostream>
#include <string>
using namespace std; 
const int maxCard =100;
//enum Boll {false, true};

class Contact 
{

public:
    Contact (const char *name, const char *address, const char *tell);
    //~ Contact(void);
    const char* Name (void)  const {return name;}
    const char* Address (void) const {return address;}
    const char* Tell (void) const {return tell;}
    friend ostream& operator<< (ostream&, Contact&);
private:
    char *name;
    char *address;
    char *tell;
}; …
Run Code Online (Sandbox Code Playgroud)

c++

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×2

visual-c++ ×1

visual-studio ×1