错误LNK2019:函数__mainCRTStartup中引用的未解析外部符号_main和错误2错误LNK1120:1个

error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup and Error 2 error LNK1120: 1 unresolved externals

本文关键字:错误 符号 外部 main 1个 LNK1120 函数 LNK2019 mainCRTStartup 引用      更新时间:2023-10-16

当我试图编译代码时,我得到了两个错误。我已经定义了win32 consile应用程序。我甚至还没有开始编码。我的配置如下-链接器-子系统-控制台;链接器-高级-入口点-空白。

       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函数必须位于全局命名空间中。C++不是所有函数都必须在类内部的C#/Java。