我使用Visual Studio试图执行一个BIGINT上课的时候,我得到这个连接错误在函数_main引用\t解析外部符号:错误LNK2019使用defalt ARGS
错误LNK2019 解析的外部符号“类BigInt __cdecl bint(void)“(?bint @@ YA?AVBigInt @@ XZ)在函数中引用_main
奇怪的是,我只在使用默认参数时才得到它。
下面是相关的代码 头文件:
#ifndef BIGINT
#define BIGINT
#pragma once
#include <string>
#include <iostream>
using namespace std;
class BigInt
{
string value;
size_t digits;
public:
BigInt(const int val=0);
~BigInt();
};
#endif
源代码:
BigInt::BigInt(const int val) :value(to_string(val))
{
digits = value.size();
}
BigInt::~BigInt()
{
}
主营:
int main()
{
BigInt bint();
return 0;
}
不编译,并给出了上面的错误。
但是这确实
int main()
{
BigInt bint(0);
cout << bint;
return 0;
}
任何想法是怎么回事?谢谢。
不要使用'()'。这是函数声明 – xinaiz
那我该用什么? –
@YairHalberstadt'BigInt bint;' –