【发布时间】:2013-03-29 06:26:08
【问题描述】:
当我尝试编译下面的代码时,出现以下错误。
Error: main.cpp: In function "int main()":
main.cpp:6: error: "display" was not declared in this scope
test1.h
#include<iostream.h>
class Test
{
public:
friend int display();
};
test1.cpp:
#include<iostream.h>
int display()
{
cout<<"Hello:In test.cc"<< endl;
return 0;
}
main.cpp
#include<iostream.h>
#include<test1.h>
int main()
{
display();
return 0;
}
奇怪的是我能够在 unix 中成功编译。 我正在使用 gcc 和 g++ 编译器
【问题讨论】:
标签: c++ c++builder