c++ - Linux 上的编译 - 在函数 '_start' : (. text+0x20) 中:对 'main' 的 undefined reference

标签 c++ linux c++11 compiler-errors g++

我想在Linux上编译一系列cpp文件。使用 CentOS 7,在 Konsole 中输入“g++ -std=c++11 main.cpp canvas.cpp patch.cpp utils.cpp”,然后收到错误:

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

谁能告诉我如何解决这个问题吗?

最佳答案

您似乎没有定义 main 函数。

关于c++ - Linux 上的编译 - 在函数 '_start' : (. text+0x20) 中:对 'main' 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59113807/

相关文章:

linux - bash 将日志文件复制到单独的目录中

C++:从装箱元素的 vector 构造一个 Box 类型的 vector

在声明点按值捕获 C++11 lambda 捕获

php - 亚马逊aws ec2 linux托管中的时区问题

linux - 有什么方法可以通过 "crm"命令从 Linux-HA 集群中找出主节点?

c++ - 如何在windows平台上使用c++信号

通过添加 legacy_stdio_definitions.lib 解决了 C++ GLFW 错误。为什么?

c++ - 头文件中的 constexpr const char*

c++ - 使用 boost::deadline_timer 延迟操作

c++ - 在 cout 语句中连接数组大小