有人可以帮助我解决下面代码清单中出现的错误吗?
该错误很可能与构造函数/析构函数有关:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: 在函数 `_start' 中:
(.text+0x20):对“main”的未定义引用
collect2:错误:ld 返回 1 退出状态
代码清单:
// counter_id.cpp
// Obco class member-function definitions.
#include <iostream>
#include "counter_id.h" // include counter class definition
using namespace std;
// constructor sets object's ID number and descriptive message
Obco::Obco( int ID, string messageString )
: objectID( ID ), message( messageString )
{
cout << "Object " << objectID << "constructor runs"
<< message << endl;
} // end CreateAndDestroy constructor
// destructor
Obco::~Obco()
{
// output newline …Run Code Online (Sandbox Code Playgroud)