compilation error

S

sam_cit

Hi All,

I have the following scenario,

A class is declared in the header file and has a static member
function sample() in sample.h
sample.cc uses the static member function sample().

the static member function sample() is under conditional compilation
SAMPLE

ifdef SAMPLE
<classname>.sample();
#endif

Now i have set the Macro SAMPLE to false in the Makefile,
SAMPLE=false

and i tried to compile the file sample.cc and it gives an error
saying, static member function() is not defined...
Can anyone help in this regard?
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

Hi All,

I have the following scenario,

A class is declared in the header file and has a static member
function sample() in sample.h
sample.cc uses the static member function sample().

the static member function sample() is under conditional compilation
SAMPLE

ifdef SAMPLE
<classname>.sample();
#endif

Now i have set the Macro SAMPLE to false in the Makefile,
SAMPLE=false

and i tried to compile the file sample.cc and it gives an error
saying, static member function() is not defined...
Can anyone help in this regard?

Set the macro SAMPLE to true.
 
S

sam_cit

Set the macro SAMPLE to true.


The compilation is fine when the macro is true. I have made sure that
a reference to sample() is always in the conditional compilation
(#ifdef SAMPLE). Hence i would expect the compilation to be fine when
the macro is false.

Also note that when i define the macro SAMPLE to be false in .h
header file, the compilation is fine without error. This makes me
think that there is an issue only when i use the makefile. Please help
me in this regard.
 
Z

Zeppe

this will always compile as long as SAMPLE is defined, no matter the
value of SAMPLE.

the function call will be included in the translation unit.

probably the definition is not included :)
The compilation is fine when the macro is true. I have made sure that
a reference to sample() is always in the conditional compilation
(#ifdef SAMPLE). Hence i would expect the compilation to be fine when
the macro is false.

maybe you are thinking at
#if SAMPLE==false
bla bla bla
#endif
?
Also note that when i define the macro SAMPLE to be false in .h
header file, the compilation is fine without error. This makes me
think that there is an issue only when i use the makefile. Please help
me in this regard.

Double error?

Regards,

Zeppe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,089
Latest member
Ketologenic

Latest Threads

Top