gcc 로 빌드하면 현재 빌드하는 시스템이 c가 아닌 cpp 라는걸 확인하기 위해(혹은 알려주기 위해)
__cplusplus 라는 선언을 -D__cplusplus 하듯 붙여주는 듯 한데
__cplusplus__가 아니라 왜 앞에만 언더바 두 개 일까.. -_-?
__STDC__ In normal operation, this macro expands to the constant 1, to signify that this compiler conforms to ISO Standard C. If GNU CPP is used with a compiler other than GCC, this is not necessarily true; however, the preprocessor always conforms to the standard unless the -traditional-cpp option is used.
This macro is not defined if the -traditional-cpp option is used.
On some hosts, the system compiler uses a different convention, where __STDC__ is normally 0, but is 1 if the user specifies strict conformance to the C Standard. CPP follows the host convention when processing system header files, but when processing user files __STDC__ is always 1. This has been reported to cause problems; for instance, some versions of Solaris provide X Windows headers that expect __STDC__ to be either undefined or 1. See Invocation.
__STDC_VERSION__ This macro expands to the C Standard’s version number, a long integer constant of the form yyyymmL where yyyy and mm are the year and month of the Standard version. This signifies which version of the C Standard the compiler conforms to. Like __STDC__, this is not necessarily accurate for the entire implementation, unless GNU CPP is being used with GCC.
The value 199409L signifies the 1989 C standard as amended in 1994, which is the current default; the value 199901L signifies the 1999 revision of the C standard; the value 201112L signifies the 2011 revision of the C standard; the value 201710L signifies the 2017 revision of the C standard (which is otherwise identical to the 2011 version apart from correction of defects). The value 202311L is used for the -std=c23 and -std=gnu23 modes. An unspecified value larger than 202311L is used for the experimental -std=c2y and -std=gnu2y modes.
This macro is not defined if the -traditional-cpp option is used, nor when compiling C++ or Objective-C.
__STDC_HOSTED__ This macro is defined, with value 1, if the compiler’s target is a hosted environment. A hosted environment has the complete facilities of the standard C library available.
__cplusplus This macro is defined when the C++ compiler is in use. You can use __cplusplus to test whether a header is compiled by a C compiler or a C++ compiler. This macro is similar to __STDC_VERSION__, in that it expands to a version number. Depending on the language standard selected, the value of the macro is 199711L for the 1998 C++ standard, 201103L for the 2011 C++ standard, 201402L for the 2014 C++ standard, 201703L for the 2017 C++ standard, 202002L for the 2020 C++ standard, 202302L for the 2023 C++ standard, or an unspecified value strictly larger than 202302L for the experimental languages enabled by -std=c++26 and -std=gnu++26.
__OBJC__ This macro is defined, with value 1, when the Objective-C compiler is in use. You can use __OBJC__ to test whether a header is compiled by a C compiler or an Objective-C compiler.
__ASSEMBLER__ This macro is defined with value 1 when preprocessing assembly language.
class my_class
{
public:
int i_var;
int f();
};
int my_class::f()
{
return ++i_var;
}
int main(void)
{
my_class *p_my_class = new my_class();
p_my_class->f();
}
iostream을 추가해서 (아직 uart 출력을 연결하진 않고 빌드만 했지만)
std::cout을 통해 출력만 해보려고 했는데
#include <iostream>
class my_class
{
public:
int i_var;
int f();
};
int my_class::f()
{
return ++i_var;
}
int main(void)
{
my_class *p_my_class = new my_class();
std::cout << p_my_class->f();
}
lv_demo_benchmark.h /** * Run all benchmark scenes. * * On the summary end screen the values shall be interpreted according to the following: * - CPU usage: * - If `LV_SYSMON_GET_IDLE` is not modified it's measured based on the time spent in * `lv_timer_handler`. * - If an (RT)OS is used `LV_SYSMON_GET_IDLE` can be changed to a custom function * which returns the idle percentage of idle task. * * - FPS: LVGL attempted to render this many times in a second. It's limited based on `LV_DEF_REFR_PERIOD` * * - Render time: LVGL spent this much time with rendering only. It's not aware of task yielding, * but simply the time difference between the start and end of the rendering is measured * * - Flush time: It's the sum of * - the time spent in the `flush_cb` and * - the time spent with waiting for flush ready. */ void lv_demo_benchmark(void);
/** * @file lv_conf.h * Configuration file for v9.3.0-dev */
/* * Copy this file as `lv_conf.h` * 1. simply next to `lvgl` folder * 2. or to any other place and * - define `LV_CONF_INCLUDE_SIMPLE`; * - add the path as an include path. */
/* clang-format off */ #if 1 /* Set this to "1" to enable content */
#ifndef LV_CONF_H #define LV_CONF_H
#define LV_BUILD_TEST_PERF 1 #define LV_USE_TEST 1 /* If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ #if 0 && defined(__ASSEMBLY__) #include "my_include.h" #endif
/*==================== HAL SETTINGS *====================*/
/** Default Dots Per Inch. Used to initialize default sizes such as widgets sized, style paddings. * (Not so important, you can adjust it to modify default sizes and spaces.) */ #define LV_DPI_DEF 130 /**< [px/inch] */
Setting PYTHONNOUSERSITE, was not set Using Python in C:\Espressif\python_env\idf5.3_py3.11_env\Scripts\ Python 3.11.2 Using Git in C:\Espressif\tools\idf-git\2.44.0\cmd\ git version 2.44.0.windows.1 Checking Python compatibility Setting IDF_PATH: C:\Espressif\frameworks\esp-idf-v5.3.1
Adding ESP-IDF tools to PATH... WARNING: The following issue occurred while accessing the ESP-IDF version file in the Python environment: [Errno 2] No such file or directory: 'C:\\Espressif\\python_env\\idf5.3_py3.11_env\\idf_version.txt'. (Diagnostic information. It can be ignored.) C:\Espressif\tools\xtensa-esp-elf-gdb\14.2_20240403\xtensa-esp-elf-gdb\bin C:\Espressif\tools\riscv32-esp-elf-gdb\14.2_20240403\riscv32-esp-elf-gdb\bin C:\Espressif\tools\xtensa-esp-elf\esp-13.2.0_20240530\xtensa-esp-elf\bin C:\Espressif\tools\esp-clang\16.0.1-fe4f10a809\esp-clang\bin C:\Espressif\tools\riscv32-esp-elf\esp-13.2.0_20240530\riscv32-esp-elf\bin C:\Espressif\tools\esp32ulp-elf\2.38_20240113\esp32ulp-elf\bin C:\Espressif\tools\cmake\3.24.0\bin C:\Espressif\tools\openocd-esp32\v0.12.0-esp32-20240318\openocd-esp32\bin C:\Espressif\tools\ninja\1.11.1\ C:\Espressif\tools\idf-exe\1.0.3\ C:\Espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64 C:\Espressif\tools\dfu-util\0.11\dfu-util-0.11-win64 C:\Espressif\frameworks\esp-idf-v5.3.1\tools
Checking if Python packages are up to date... Constraint file: C:\Espressif\espidf.constraints.v5.3.txt Requirement files: - C:\Espressif\frameworks\esp-idf-v5.3.1\tools\requirements\requirements.core.txt Python being checked: C:\Espressif\python_env\idf5.3_py3.11_env\Scripts\python.exe Python requirements are satisfied.
Detected installed tools that are not currently used by active ESP-IDF version. For removing old versions of amazon-corretto-11-x64-windows-jdk, espressif-ide, idf-driver, idf-python-wheels use command 'python.exe C:\Espressif\frameworks\esp-idf-v5.3.1\tools\idf_tools.py uninstall' For free up even more space, remove installation packages of those tools. Use option 'python.exe C:\Espressif\frameworks\esp-idf-v5.3.1\tools\idf_tools.py uninstall --remove-archives'.
Done! You can now compile ESP-IDF projects. Go to the project directory and run:
idf.py build
C:\Espressif\frameworks\esp-idf-v5.3.1>cd \
C:\>cd src
C:\src>dir C 드라이브의 볼륨에는 이름이 없습니다. 볼륨 일련 번호: 6A30-5BAD
C:\src 디렉터리
2026-02-10 오후 11:02 <DIR> . 0개 파일 0 바이트 1개 디렉터리 383,856,386,048 바이트 남음
C:\src>idf.py create-project lvgl Executing action: create-project The project was created in C:\src\lvgl
C:\src>dir C 드라이브의 볼륨에는 이름이 없습니다. 볼륨 일련 번호: 6A30-5BAD
C:\src 디렉터리
2026-02-18 오전 10:57 <DIR> . 2026-02-18 오전 10:57 <DIR> lvgl 0개 파일 0 바이트 2개 디렉터리 383,198,498,816 바이트 남음
C:\src>cd lvgl
C:\src\lvgl>dir C 드라이브의 볼륨에는 이름이 없습니다. 볼륨 일련 번호: 6A30-5BAD
C:\src\lvgl 디렉터리
2026-02-18 오전 10:57 <DIR> . 2026-02-18 오전 10:57 <DIR> .. 2026-02-18 오전 10:57 373 CMakeLists.txt 2026-02-18 오전 10:57 <DIR> main 1개 파일 373 바이트 3개 디렉터리 383,198,498,816 바이트 남음
C:\src\lvgl>cd main
C:\src\lvgl\main>dir C 드라이브의 볼륨에는 이름이 없습니다. 볼륨 일련 번호: 6A30-5BAD
C:\src\lvgl\main 디렉터리
2026-02-18 오전 10:57 <DIR> . 2026-02-18 오전 10:57 <DIR> .. 2026-02-18 오전 10:57 77 CMakeLists.txt 2024-11-06 오후 08:17 51 lvgl.c 2개 파일 128 바이트 2개 디렉터리 383,198,498,816 바이트 남음
C:\src\lvgl>idf.py menuconfig Executing action: menuconfig Running ninja in directory C:\src\lvgl\build Executing "ninja menuconfig"... [0/1] cmd.exe /C "cd /D C:\src\lvgl\build && C:\Espressif\..._INIT_VERSION=5.3.1 --output config C:/src/lvgl/sdkconfig"C:/Espressif/frameworks/esp-idf-v5.3.1/Kconfig:15: warning: IDF_ENV_FPGA has 'option env="IDF_ENV_FPGA"', but the environment variable IDF_ENV_FPGA is not set Loaded configuration 'C:/src/lvgl/sdkconfig' No changes to save (for 'C:/src/lvgl/sdkconfig')
[0/1] cmd.exe /C "cd /D C:\src\lvgl\build && C:\Espressif\..._INIT_VERSION=5.3.1 --output config C:/src/lvgl/sdkconfig"C:/Espressif/frameworks/esp-idf-v5.3.1/Kconfig:15: warning: IDF_ENV_FPGA has 'option env="IDF_ENV_FPGA"', but the environment variable IDF_ENV_FPGA is not set Loaded configuration 'C:/src/lvgl/sdkconfig' Configuration saved to 'C:/src/lvgl/sdkconfig'