错误LNK2019:函数__mainCRTStartup中引用的未解析外部符号_main和错误2错误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。
相关文章:
- 在C++中使用内联方法时出现未定义的符号错误
- 我收到错误LNK2001:未解析的外部符号(C++代码)
- 错误:隐式转换更改符号:'int'到'unsigned long'
- 错误:当我从"WinDbg"打开可执行文件时,找不到符号文件。默认导出 ntdll 的符号.dll
- 可视抽象类 c++(错误 LNK 2001:未解析的外部符号)
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 添加符号 libgtest.so 错误:命令行中缺少 DSO
- 如何摆脱C++中未解析的外部符号"private: static char"错误?
- 当 lib 已添加到其他依赖项时,如何在 VS 中调试未解析的外部符号错误
- 体系结构x86_64的未定义符号:链接器错误
- 错误LNK2019未解析的外部符号"public: __thiscall SLinkList<char>::SLinkList<char>(void)"
- 引入参数化构造函数后显示 LNK 2019 未解析外部符号的代码错误
- 与Qt交叉编译到Raspberry Pi 3B+通讯录(协议缓冲区)-错误符号查找错误
- 链接错误:符号重复
- 架构X86_64静态类成员的错误符号X86_64错误
- 缓冲区中使用 GetWindowText 的错误符号
- OSX:ld:警告:错误符号操作:适用于核心库
- 为什么 Folly 的共享库引用了 Boost 中的错误符号?(OS X 上的 GCC)
- 嵌入lua运行时错误:符号未找到:_luaL_newstate
- C++ 找不到"::"架构的苹果马赫-O链接器错误/符号