Songling wrote:
I had some very interesting include problems. Please see descriptions below.
In "MyObj.cc" file, I used the following lines to do the include,
#pragma implementation <MyObj.h>
#include <MyObj.h>
In "MyObj.h" file, I do the followings,
#pragma interface
#include <MyHdr.h>
In "MyHdr.h" I define type A. But when I try to use type A in "MyObj.cc",
the complier
complains that type A is undefined. The compiler I'm using should be
diab-5.1.
Can anybody be kind enough to help?
Somebody in a newsgroup dedicated to your compiler must be able to.
#pragma directives are compiler-specific.
If you just do
------------------------------------------- in MyObj.h
#include <MyHdr.h>
------------------------------------------- in MyObj.cc
#include <MyObj.h>
A a;
------------------------------------------- in MyHdr.h
class A {};
-------------------------------------------
, does it work? If it does, you don't have a C++ problem. And even
if it doesn't, are you sure you're including the right files from the
right locations? Specifying the locations where the headers are found
is also compiler-specific, unfortunately.
Drop the pragmas and try again. If it still doesn't work, reduce your
code to the bare minimum that doesn't work and post it here.
Victor