簡體   English   中英

錯誤LNK2019:函數___tmainCRTStartup和錯誤2中引用了未解析的外部符號_main錯誤LNK1120:1個未解析的外部

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

嘗試編譯代碼時出現兩個錯誤。 我已經定義了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,其中所有功能都必須在類內部。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM