Skip to main content
edited body
Source Link
Servuc
  • 133
  • 5

I've a little problem, I'm trying to create a library with processor variables for tune it.

So in .ino I declared my preprocessor var, but preprocessor variables appear not defined in my library. (Notice that I've create a folder test/test.h in libraries directory of Arduino IDE)

Some code to reproduce the problem :

test.ino :

#define TEST
    
#include "test.h"
    
void setup() {}
void loop() {}

test.h (edited, reverse error message, this is solution)

#if defined(TEST)
  #error "NOT DEFINED""DEFINED"
#else
  #error "DEFINED""NOT DEFINED"
#endif

If I compile it, I fall on #error "NOT DEFINED".

Somebody with an idea ?

Have a good day

I've a little problem, I'm trying to create a library with processor variables for tune it.

So in .ino I declared my preprocessor var, but preprocessor variables appear not defined in my library. (Notice that I've create a folder test/test.h in libraries directory of Arduino IDE)

Some code to reproduce the problem :

test.ino :

#define TEST
    
#include "test.h"
    
void setup() {}
void loop() {}

test.h

#if defined(TEST)
  #error "NOT DEFINED"
#else
  #error "DEFINED"
#endif

If I compile it, I fall on #error "NOT DEFINED".

Somebody with an idea ?

Have a good day

I've a little problem, I'm trying to create a library with processor variables for tune it.

So in .ino I declared my preprocessor var, but preprocessor variables appear not defined in my library. (Notice that I've create a folder test/test.h in libraries directory of Arduino IDE)

Some code to reproduce the problem :

test.ino :

#define TEST
    
#include "test.h"
    
void setup() {}
void loop() {}

test.h (edited, reverse error message, this is solution)

#if defined(TEST)
  #error "DEFINED"
#else
  #error "NOT DEFINED"
#endif

If I compile it, I fall on #error "NOT DEFINED".

Somebody with an idea ?

Have a good day

Source Link
Servuc
  • 133
  • 5

Preprocessing problem

I've a little problem, I'm trying to create a library with processor variables for tune it.

So in .ino I declared my preprocessor var, but preprocessor variables appear not defined in my library. (Notice that I've create a folder test/test.h in libraries directory of Arduino IDE)

Some code to reproduce the problem :

test.ino :

#define TEST
    
#include "test.h"
    
void setup() {}
void loop() {}

test.h

#if defined(TEST)
  #error "NOT DEFINED"
#else
  #error "DEFINED"
#endif

If I compile it, I fall on #error "NOT DEFINED".

Somebody with an idea ?

Have a good day