Hi Everyone,
I have the following files,
file.h
typedef struct
{
int data;
#if (MACRO == 1)
int net_data;
#endif
} Object;
file1.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
file2.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
When i compile the file1.cpp it compiles fine without any errors,
however the file2.cpp gives an error saying
"C2363E: member net_data not found in struct object"
Note that the macro is set to 1 before compilation of these two
files... I'm not able to figure out as to why the file.h is expanded
(with MACRO as 0) and file2.cpp is expanded (with MACRO as 0)...
Has anyone faced similar situation? I have no clue as to how to fix
the problem?
Thanks in advance !!! 5 1649
Rahul wrote:
Hi Everyone,
I have the following files,
file.h
typedef struct
{
int data;
#if (MACRO == 1)
int net_data;
#endif
} Object;
file1.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
file2.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
When i compile the file1.cpp it compiles fine without any errors,
however the file2.cpp gives an error saying
"C2363E: member net_data not found in struct object"
Note that the macro is set to 1 before compilation of these two
files... I'm not able to figure out as to why the file.h is expanded
(with MACRO as 0) and file2.cpp is expanded (with MACRO as 0)...
Has anyone faced similar situation? I have no clue as to how to fix
the problem?
What is "cc"? Once you figure it out, post to the newsgroup that
deals with it, because your question is apparently compiler-specific.
If instead of defining your macro (and, BTW, did you give it the value
'1' at that time?) in the command line (seems that's what you did) you
define it like so:
------- file2.cpp
#define MACRO 1
#include "file.h"
...
, does it work then? If it does, and in the command line it does not,
you got the _usage_ issue, not a language issue.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
On May 7, 5:36 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
Rahul wrote:
Hi Everyone,
I have the following files,
file.h
typedef struct
{
int data;
#if (MACRO == 1)
int net_data;
#endif
} Object;
file1.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
file2.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
When i compile the file1.cpp it compiles fine without any errors,
however the file2.cpp gives an error saying
"C2363E: member net_data not found in struct object"
Note that the macro is set to 1 before compilation of these two
files... I'm not able to figure out as to why the file.h is expanded
(with MACRO as 0) and file2.cpp is expanded (with MACRO as 0)...
Has anyone faced similar situation? I have no clue as to how to fix
the problem?
What is "cc"? Once you figure it out, post to the newsgroup that
deals with it, because your question is apparently compiler-specific.
If instead of defining your macro (and, BTW, did you give it the value
'1' at that time?) in the command line (seems that's what you did) you
define it like so:
------- file2.cpp
#define MACRO 1
#include "file.h"
...
, does it work then? If it does, and in the command line it does not,
you got the _usage_ issue, not a language issue.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
I meant, Conditional compilation by cc... I posted in here, as c++
developers over here might have faced this issue...
Rahul wrote:
On May 7, 5:36 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
>Rahul wrote:
>>Hi Everyone,
>>I have the following files,
>>file.h
>>typedef struct { int data; #if (MACRO == 1) int net_data; #endif } Object;
>>file1.cpp
>>#include "file.h" uses object.data and object.net_data (under MACRO cc)
>>file2.cpp
>>#include "file.h" uses object.data and object.net_data (under MACRO cc)
>>When i compile the file1.cpp it compiles fine without any errors, however the file2.cpp gives an error saying
>>"C2363E: member net_data not found in struct object"
>>Note that the macro is set to 1 before compilation of these two files... I'm not able to figure out as to why the file.h is expanded (with MACRO as 0) and file2.cpp is expanded (with MACRO as 0)...
>> Has anyone faced similar situation? I have no clue as to how to fix the problem?
What is "cc"? Once you figure it out, post to the newsgroup that deals with it, because your question is apparently compiler-specific.
If instead of defining your macro (and, BTW, did you give it the value '1' at that time?) in the command line (seems that's what you did) you define it like so:
------- file2.cpp #define MACRO 1 #include "file.h" ...
, does it work then? If it does, and in the command line it does not, you got the _usage_ issue, not a language issue.
V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask
I meant, Conditional compilation by cc... I posted in here, as c++
developers over here might have faced this issue...
Uh... How to break it to ya... There are _literally_ scores of
different compilers out there. "C++ developers over here" use all
of them. Half of those compilers have their main module named 'cc'
(or something very close). Which ones did you intend to reach with
your post? Once again, your issue is not of the _langauge_ kind
but relates to the _usage of your compiler_. Ask in the newsgroup
that *deals with your particular compiler*. If you are unsure what
newsgroup to post to, at least state the platform you're using and
the version of your compiler, then we can suggest a particular NG
for you. And RTFFAQ before posting as well.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
On May 7, 1:24*pm, Rahul <sam_...@yahoo.co.inwrote:
Hi Everyone,
*I have the following files,
*file.h
*typedef struct
*{
* int data;
#if (MACRO == 1)
* int net_data;
#endif
*} Object;
*file1.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
*file2.cpp
#include "file.h"
uses object.data and object.net_data (under MACRO cc)
*When i compile the file1.cpp it compiles fine without any errors,
however the file2.cpp gives an error saying
*"C2363E: member net_data not found in struct object"
*Note that the macro is set to 1 before compilation of these two
files... I'm not able to figure out as to why the file.h is expanded
(with MACRO as 0) and file2.cpp is expanded (with MACRO as 0)...
* Has anyone faced similar situation? I have no clue as to how to fix
the problem?
Your compiler will most likely have an option to dump the
preprocessor output to a file (it's -P or -E for MSVC I think);
find out what it is for your compiler, compile using said option
and have a look at the files produced. This should give you
a clue as to what's going on.
On May 7, 2:48 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
[...]
Uh... How to break it to ya... There are _literally_ scores
of different compilers out there. "C++ developers over here"
use all of them. Half of those compilers have their main
module named 'cc' (or something very close).
Actually, I don't know of any C++ compilers that are invoked by
cc: I've got CC, g++ and cl here, with xlC and acc on some
machines I've used in the past. Under Unix, cc is classically
used to invoke the C compiler, so can't be the C++ compiler.
(As for the rest, of course... We need a minimum compilable
example. I don't know of any compiler that just randomly
defines macros, so obviously, it's being defined somewhere.
Also, of course, using conditional compilation to change the
layout of a structure is just looking for trouble. And is
totally unmaintainable.)
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: konf |
last post by:
Hallo,
I tried to compile PGSQL 7.4 and I got error (durring make):
ar: command not found
What is it? Whe I can found it?
I have:
$ uname -a
SunOS ... 5.8 Generic_108528-03 sun4u sparc...
|
by: Sune |
last post by:
Hi,
previously I used Eclipse CDT for compiling my files just to get
started with C and leave C++ behind. Now it's time to get a little more
serious so I've moved my files to a new workplace and...
|
by: Joachim |
last post by:
I made some project changes (which seems it doesn't help if I undo) which
have created compilation error:
"
Server Error in '/PCSWebApp1' Application....
|
by: James Zhuo |
last post by:
Hi all
I've been getting the following compilation error. I should explain the
background of the project that i am taking over. This is a project that has
been developed by someone else a while...
|
by: James Zhuo |
last post by:
hi all
I changed the name of the class LoginPage to a different
name "LoginPageOne" But the same error gets generated with
the Wiliam.Request.LoginPageOne. That pretty much leaves
me clueless...
| |
by: Dan |
last post by:
Hi,
I have a problem using an aspx page with a Control on it. I get the
following error message
Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple
places; using definition...
|
by: Plat |
last post by:
I've Googled this for a while, to no avail. Hopefully someone can help me.
Maybe I'm using the wrong terminology.
Here's the scoop! Let's say I've got a simple *.ASPX page that has a syntax...
|
by: Robert |
last post by:
I have a number of web projects converted from 1.1 to 2.0 in VS2005.
I am methodically seeing the error below:
The element 'compilation' has invalid child element 'compilers'. List of...
|
by: Stimp |
last post by:
I've created an aspx page called HistoryManage.aspx.
The page works fine on my local machine but when I load it off the web I
get the following strange error...
Compilation Error...
|
by: BSand0764 |
last post by:
I'm getting an error that I can't seem to resolve. When I compile the
Functor related logic in a test program, the files compile and execute
properly (see Listing #1).
However, when I...
|
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,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |