Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » arduino / sloeber: how to use #define via configuration?
arduino / sloeber: how to use #define via configuration? [message #1851844] Tue, 19 April 2022 16:33 Go to next message
Andreas Butch is currently offline Andreas ButchFriend
Messages: 1
Registered: April 2022
Junior Member
Hi, I am fairly new to eclipse. I am programming arduino with sloeber IDE which is based on eclipse. I assume that my question is generic to c++ eclipse IDE, so that you may help in general.

Since arduino is not capable of using the normal debugger, I need to use debug messages on serial interface to see whats going on. I would like to have debug and release builds. Debug is containing will set some #defines to active while they are not defined or inactive in a release build.

I created a header file debug_includes/config.h with following content:

#ifndef CONFIGURATION_DEBUG_H_
#define CONFIGURATION_DEBUG_H_

#define PROJECT_CONFIG_IS_DEBUG 1
#define IS_DEBUG_TB6612 1
#define TB6612_ENABLE_OUTPUTS 1

#endif /* CONFIGURATION_DEBUG_H_ */


I included this file as c++ preprocessor file (see screenshot):
index.php/fa/41948/0/

Within the IDE it looks good, the debug part is active:
index.php/fa/41949/0/

But when I want to build I get the following error:
18:18:41 **** Build of configuration debug for project NRF24L01_receiver ****
"D:\\Sloeber_4.4.0\\arduinoPlugin\\tools\\make\\make" all 
'Building file: ..\sloeber.ino.cpp'
'Starting C++ compile'
"D:\Sloeber_4.4.0\arduinoPlugin\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10812 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR     -I"D:\Arduino\workspace_git\workspace_new\NRF24L01_receiver\debug_includes" -I"D:\Sloeber_4.4.0\arduinoPlugin\packages\arduino\hardware\avr\1.8.5\cores\arduino" -I"D:\Arduino\libraries\EnhancedServo" -I"D:\Arduino\libraries\MotorDriverTB6612FNG" -I"D:\Sloeber_4.4.0\arduinoPlugin\libraries\RF24\1.4.1" -I"D:\Sloeber_4.4.0\arduinoPlugin\libraries\ArduinoLog\1.1.1" -I"D:\Sloeber_4.4.0\arduinoPlugin\packages\arduino\hardware\avr\1.8.5\libraries\SPI\src" -I"D:\Sloeber_4.4.0\arduinoPlugin\libraries\Servo\1.1.8\src" -I"D:\Sloeber_4.4.0\arduinoPlugin\libraries\RF24\1.4.1\utility" -I"D:\Sloeber_4.4.0\arduinoPlugin\libraries\FastCRC\1.42.0\src" -I"D:\Arduino\libraries\MemoryFree" -I"D:\Sloeber_4.4.0\arduinoPlugin\packages\arduino\hardware\avr\1.8.5\variants\eightanaloginputs" -MMD -MP -MF"sloeber.ino.cpp.d" -MT"sloeber.ino.cpp.o" -D__IN_ECLIPSE__=1 -x c++ "..\sloeber.ino.cpp"   -o "sloeber.ino.cpp.o"
..\sloeber.ino.cpp:8:1: error: 'null' does not name a type
 null
 ^~~~
In file included from ..\sloeber.ino.cpp:32:0:
D:\Sloeber_4.4.0\arduinoPlugin\libraries\ArduinoLog\1.1.1/ArduinoLog.h: In member function 'void Logging::print(const Printable&, va_list)':
D:\Sloeber_4.4.0\arduinoPlugin\libraries\ArduinoLog\1.1.1/ArduinoLog.h:329:43: warning: unused parameter 'args' [-Wunused-parameter]
  void print(const Printable& obj, va_list args)
                                           ^~~~
make: *** [subdir.mk:20: sloeber.ino.cpp.o] Error 1
"D:/Sloeber_4.4.0/arduinoPlugin/tools/make/make all" terminated with exit code 2. Build might be incomplete.

18:18:43 Build Failed. 2 errors, 1 warnings. (took 2s.916ms)


The generated sloeber.cpp looks like this:

#include "Arduino.h"
null
#define LED_RIGHT 1
#define IS_MODEL_GENERIC 0
#define IS_MODEL_BULLY 0
#define IS_MODEL_POLICE_PORSCHE 0
....


It does not matter if I choose preprocessor macro file or include file for pointing at the file. The error is the same.
What am I missing? Can anyone help?

Looks like the IDE (editor) is working correctly, but something weird is happening during build.

Thanks a lot
Re: arduino / sloeber: how to use #define via configuration? [message #1851849 is a reply to message #1851844] Wed, 20 April 2022 00:11 Go to previous message
Gleb Plekhotko is currently offline Gleb PlekhotkoFriend
Messages: 5
Registered: April 2022
Junior Member
I'm not familiar with Sloeber and have no idea what and how it "generates" but this "null" is definitely out of place:
#include "Arduino.h"
null
#define LED_RIGHT 1

It is not a variable, it is not a macro, it is just a random text from the compiler's point of view. Check how you've got it in you source file.
Previous Topic:Failed to execute MI command: -data-evaluate-expression
Next Topic:External browser with relative paths
Goto Forum:
  


Current Time: Mon Jan 30 18:37:36 GMT 2023

Powered by FUDForum. Page generated in 0.14943 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top