当我尝试编译我的代码时,我遇到了两个错误。我已经定义了 win32 控制台应用程序。我什至还没有开始编码。我的配置如下 - 链接器 - 子系统 - 控制台;链接器 - 高级 - 入口点 - 空白。
error LNK2019: unresolved external symbol _main referenced in function
___tmainCRTStartup
Error 2 error LNK1120: 1 unresolved externals
我不知道发生了什么。以前一切正常,但从今天开始就不行了。您知道我该如何解决吗?
到目前为止我的代码是
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "tbb/blocked_range.h"
#include "tbb/tbb.h"
#include <stdio.h>
#include <math.h>
#include <iostream>
#include "tbb/parallel_for.h"
#include <sstream>
#include <tbb/task_scheduler_init.h>
using namespace std;
#define PI 3.14159265
using namespace tbb;
// Sequential Execution
class Sequential
{
double * m;
double *n;
public:
Sequential(double n[], double m[]): n(n), m(m){}
void Partition()
{
}
int main(int argc, char** argv)
{
//double a = 5;
//double b = 4;
//Sequential g = Sequential(a,b);
return 0;
}
};
谢谢
最佳答案
main
函数必须位于global 命名空间中。 C++ 不是 C#/Java,后者的所有函数都必须在类中。
关于c++ - 错误 LNK2019 : unresolved external symbol _main referenced in function ___tmainCRTStartup and Error 2 error LNK1120: 1 unresolved externals,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23153900/