TcMenu / TaskManagerIO

A task, event, scheduling, and interrupt marshalling library for Arduino and mbed boards.
Apache License 2.0
122 stars 12 forks source link

How I can add this flag to my compile options esp8266 #31

Closed mrdsn3 closed 3 years ago

mrdsn3 commented 3 years ago

How I can add this flag to my compile options DTM_ENABLE_CAPTURED_LAMBDAS

davetcc commented 3 years ago

Depends on the IDE and build tool basically.

You need to add a compiler define flag. For example in platformIO you add build_flags to a target as per: https://github.com/davetcc/tcLibraryDev/blob/master/platformio.ini

While regular Arduino IDE does not support build flags directly, you would need to manually set it in the file. https://github.com/davetcc/TaskManagerIO/blob/master/src/TaskPlatformDeps.h

davetcc commented 3 years ago

BTW the flag is TM_ENABLE_CAPTURED_LAMBDAS the -D at the beginning is the option for setting a flag in gcc.

mrdsn3 commented 3 years ago

thanks so is this code added the flag? is this right? `#include

if !defined(TM_ENABLE_CAPTURED_LAMBDAS)

define TM_ALLOW_CAPTURED_LAMBDA

endif

void setup() { // put your setup code here, to run once:

}

void loop() { // put your main code here, to run repeatedly:

}`

davetcc commented 3 years ago

Unfortunately for Arduino IDE it has to go into TaskPlatformDeps.h in the library, otherwise it will not be picked up when compiling the library.

If you are using the pro IDE, Eclipse, or platformIO you can define the flag in the build tool.

mrdsn3 commented 3 years ago

OK thanks