以下のコードをコンパイルしようとすると、以下のエラーが発生します。
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++ コンパイラを使用しています