473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

#pragma problem?

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?

Thanks!

Songling

Jul 22 '05 #1
1 1293
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
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jacob Jensen | last post by:
Hi I have a problem creating C++ code that is multiplatform compilable. My problem is using the "#pragma once" directive which can be used by microsoft Visual Studio pre-compiler but which gives...
6
by: Shri | last post by:
Can anybody tell me where i can find a detailed document on #pragma .... --shri
1
by: Gustavo L. Fabro | last post by:
Greetings! Going directly to the point: myclass.h: //-------------------------------------- #pragma managed //Forward declaration
11
by: ramu | last post by:
HI, Can anyone tell me about pragma? And can u give an example of how to use it?
15
by: muttaa | last post by:
Hello all, I'm a beginner in C...May i like to know the difference between a #pragma and a #define.... Also,yet i'm unclear what a pragma is all about as i can find topics on it only in...
5
by: venkat | last post by:
Hi, I have come across the a pragma definition " #pragma switch direct ". I don't know any thing about pragma's. Even i when i search through google not getting exact information. what does...
26
by: Rick | last post by:
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use? ...
2
by: aleemakhtar1 | last post by:
wat is use of pragma directive in embedded sys ??
0
debasisdas
by: debasisdas | last post by:
PRAGMA:-Signifies that the statement is a pragma (compiler directive). Pragmas are processed at compile time, not at run time. They pass information to the compiler. A pragma is an instruction to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.