Re: Undefine a typedef

Discussion in 'C++' started by, 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. Advertisements

  2. Ian Collins Guest

    Ian Collins, May 19, 2014
    1. Advertisements

  3. 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 Müller, May 19, 2014
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.