请教:Anjuta 下编译C++程序的问题
发表于 : 2008-04-16 17:05
用anjuta创建一个C++工程,默认出来一个 helloword 程序。
我在工程里添加一个test.h 和 test.cc
内容如下:
test.h
void test();
test.cc
#include "test.h"
#include <iostream>
void test()
{
std::cout<<"test\n";
}
main.cc
#include "test.h"
int main()
{
test();
return 0;
}
生成时就出错了:undefined reference to 'test()'
想不通这个为什么会错阿?
谢谢拉!
我在工程里添加一个test.h 和 test.cc
内容如下:
test.h
void test();
test.cc
#include "test.h"
#include <iostream>
void test()
{
std::cout<<"test\n";
}
main.cc
#include "test.h"
int main()
{
test();
return 0;
}
生成时就出错了:undefined reference to 'test()'
想不通这个为什么会错阿?
谢谢拉!