simplecpp icon indicating copy to clipboard operation
simplecpp copied to clipboard

Problems with ##

Open pozzugno opened this issue 2 years ago • 1 comments

I tested the following source file:

#include <stdio.h>

#define __SAMC21N18A__
#define SAM_PART_IS_DEFINED(part)       (defined(__ ## part ## __))

#define SAM     SAM_PART_IS_DEFINED(SAMC21N18A)


int main()
{
#if SAM
    printf("Hello World");
#endif

    return 0;
}

gcc compiles it and the application shows "Hello World" as expected. However, when I process with simplecpp, I obtain:

$ simplecpp mytest.c                                             
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
int main ( )                                                     
{                                                                
                                                                 
                                                                 
                                                                 
                                                                 
return 0 ;                                                       
}                                                                
mytest.c:1: missing header: Header not found: <stdio.h>          

The macro SAM_PART_IS_DEFINED() is derived from a third party library from Atmel/Microchip. See here

pozzugno avatar Aug 29 '22 07:08 pozzugno

Think this is the same error I am experiencing: #300

hobala avatar Aug 07 '23 17:08 hobala