Re: Undefine a typedef

Discussion in 'C++' started by rspriyakrishnan@gmail.com, May 19, 2014.

  1. Guest

    I have a typedef something name1 in header file1
    in headerfile2 typedef something name1
    now if i include both the headerfiles, the variable conflict is coming..
    the same thing happened with macro, i just used ifdef,undef,
    but in this case, i didn't find any solution,
    Please help!!!
     
    , May 19, 2014
    #1
    1. Advertisements

  2. Ian Collins Guest

    wrote:
    > I have a typedef something name1 in header file1
    > in headerfile2 typedef something name1
    > now if i include both the headerfiles, the variable conflict is coming..
    > the same thing happened with macro, i just used ifdef,undef,
    > but in this case, i didn't find any solution,


    Namespaces.

    --
    Ian Collins
     
    Ian Collins, May 19, 2014
    #2
    1. Advertisements

  3. On 19.05.14 11.42, wrote:
    > I have a typedef something name1 in header file1
    > in headerfile2 typedef something name1
    > now if i include both the headerfiles, the variable conflict is coming..
    > the same thing happened with macro, i just used ifdef,undef,
    > but in this case, i didn't find any solution,
    > Please help!!!


    If the files are yours, then namespaces are the means of choice.

    If you are stuck with third party includes of C type then you can
    increase the confusion by placing a #define between the two includes.
    This will replace the symbol in the second include by a new one. If you
    #undef the symbol after the include then you can use both ones in your
    compilation unit.
    This violates half a dozen rules. Practically typedefs usually do not
    change the object code of extern "C" symbols.


    Marcel
     
    Marcel Müller, May 19, 2014
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmljaA==?=
    Replies:
    15
    Views:
    8,413
    aparnalr
    Sep 14, 2011
  2. Rafal 'Raf256' Maj

    undefine all macros from a file

    Rafal 'Raf256' Maj, Jan 19, 2005, in forum: C++
    Replies:
    1
    Views:
    3,172
    Jonathan Turkanis
    Jan 19, 2005
  3. Alden Pierre
    Replies:
    7
    Views:
    622
  4. Pietro Cerutti

    undefine for functions

    Pietro Cerutti, Aug 30, 2007, in forum: C Programming
    Replies:
    8
    Views:
    623
    Eric Sosman
    Aug 31, 2007
  5. oor
    Replies:
    0
    Views:
    1,766
  6. T Ryi

    Undefine a function from header file

    T Ryi, Mar 24, 2010, in forum: C Programming
    Replies:
    6
    Views:
    1,476
    Kenny McCormack
    Mar 25, 2010
  7. tony summerfelt

    undefine

    tony summerfelt, Jun 12, 2004, in forum: Ruby
    Replies:
    39
    Views:
    617
    tony summerfelt
    Jun 16, 2004
  8. Adriano Mitre
    Replies:
    7
    Views:
    266
    Adriano Mitre
    Nov 7, 2006
Loading...