Dear All,
I got “Import is not defined” message from Pylance in my extra_scripts for a C++ project. Below is the content of platformio.ini and script.py: I could not figure out what was happening and how to fix it. Help is appreciated.
Import("env")
# General options that are passed to the C and C++ compilers
env.Append(CCFLAGS=[])
# General options that are passed to the C compiler (C only; not C++).
env.Append(CFLAGS=[])
# General options that are passed to the C++ compiler
env.Append(CXXFLAGS=["-Wno-deprecated-declarations",
"-Wno-register",
"-Wno-pmf-conversions"])
I thought the problem had been solved by ignoring the warning. However, the CXXFLAGS I specify in the script.py does not work. The compile emits a lot of warnings that should have been disabled in the “script.py.” Any idea? Below is part of the warning message.
/home/ev/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_rtc.h:1293:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
1293 | register uint32_t temp = 0U;
I modified the script as below, but it does nothing to the warning messages…
from SCons.Script import (DefaultEnvironment)
env = DefaultEnvironment()
# General options that are passed to the C and C++ compilers
env.Append(CCFLAGS=[])
# General options that are passed to the C compiler (C only; not C++).
env.Append(CFLAGS=[])
# General options that are passed to the C++ compiler
env.Append(CXXFLAGS=["-Wno-deprecated-declarations",
"-Wno-register",
"-Wno-pmf-conversions"])