Macros : error: pasting does not give a valid preprocessing token

Discussion in 'C Programming' started by girishk.k4, Mar 23, 2013.

  1. girishk.k4

    girishk.k4

    Joined:
    Mar 23, 2013
    Messages:
    1
    Likes Received:
    0
    Can someone tell me what is wrong here ?

    #define LOG_MACRO(format,args...) printf(format,args)

    #define TEST_MACRO(__arg1, __arg2, __format, args...) LOG_MACRO("ARG1: %s, ARG2 : %s" ## __format, ##args)

    char* arg1 = "test";
    char* arg2 = "test";
    TEST_MACRO(arg1,arg2,"Testing Macro %s","foo");


    error: pasting ""ARG1: %s, ARG2 : %s"" and ""Testing Macro %s"" does not give a valid preprocessing token
     
    girishk.k4, Mar 23, 2013
    #1
    1. Advertisements

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.
Similar Threads
  1. Cronus
    Replies:
    1
    Views:
    1,027
    Paul Mensonides
    Jul 15, 2004
  2. Francois Grieu

    Can #include use a preprocessing token?

    Francois Grieu, Jun 9, 2004, in forum: C Programming
    Replies:
    12
    Views:
    764
    Richard Bos
    Jun 10, 2004
  3. Frodo Baggins

    "does not give a valid preprocessing token"... Why?

    Frodo Baggins, Sep 15, 2004, in forum: C Programming
    Replies:
    3
    Views:
    2,476
    Frodo Baggins
    Sep 16, 2004
  4. Chris

    macros: not a valid preprocessing token

    Chris, May 10, 2005, in forum: C Programming
    Replies:
    5
    Views:
    2,359
    Chris Torek
    May 11, 2005
  5. Wessi
    Replies:
    3
    Views:
    1,192
    Lawrence Kirby
    Aug 11, 2005
  6. Mark Odell

    Token-pasting trouble

    Mark Odell, Apr 6, 2006, in forum: C Programming
    Replies:
    8
    Views:
    650
    Mark Odell
    Apr 6, 2006
  7. Mark Odell
    Replies:
    7
    Views:
    554
    Mark Odell
    May 1, 2006
  8. Ben Bacarisse

    Re: String literals in macros that use token pasting

    Ben Bacarisse, Aug 3, 2009, in forum: C Programming
    Replies:
    2
    Views:
    1,581
    Anand Hariharan
    Aug 4, 2009
Loading...