当前位置: 技术问答>linux和unix
g++编译类出错
来源: 互联网 发布时间:2016-07-03
本文导语: 小弟刚接触linux,我问一个菜鸟问题,我定义了一个类 比如: //头文件 class test { public: test(); ~test(); }; //cpp文件 #include"test.h" test::test() { } test::~test() ...
小弟刚接触linux,我问一个菜鸟问题,我定义了一个类 比如:
//头文件
class test
{
public:
test();
~test();
};
//cpp文件
#include"test.h"
test::test()
{
}
test::~test()
{
}
$ g++ test.h test.cpp -o t
我在使用g++编译的时候提示 /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start':
/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
请问怎么解决?谢谢、、、、
//头文件
class test
{
public:
test();
~test();
};
//cpp文件
#include"test.h"
test::test()
{
}
test::~test()
{
}
$ g++ test.h test.cpp -o t
我在使用g++编译的时候提示 /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start':
/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
请问怎么解决?谢谢、、、、
|
gcc -c