compilation error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sam_cit@yahoo.co.in

    compilation error

    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>.sam ple();
    #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?=

    #2
    Re: compilation error

    On 10 Apr, 13:39, sam_...@yahoo.c o.in wrote:
    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>.sam ple();
    #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.

    --
    Erik Wikström

    Comment

    • sam_cit@yahoo.co.in

      #3
      Re: compilation error

      On Apr 10, 5:38 pm, "Erik Wikström" <eri...@student .chalmers.se>
      wrote:
      On 10 Apr, 13:39, sam_...@yahoo.c o.in wrote:
      >
      >
      >
      >
      >
      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>.sam ple();
      #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.
      >
      --
      Erik Wikström- Hide quoted text -
      >
      - Show quoted text -

      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.

      Comment

      • Zeppe

        #4
        Re: compilation error

        sam_cit@yahoo.c o.in wrote:
        >> the static member function sample() is under conditional compilation
        >>SAMPLE
        >>ifdef SAMPLE
        >><classname>.s ample();
        >>#endif
        this will always compile as long as SAMPLE is defined, no matter the
        value of SAMPLE.
        >> Now i have set the Macro SAMPLE to false in the Makefile,
        >>SAMPLE=fals e
        the function call will be included in the translation unit.
        >>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?
        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


        Comment

        Working...