VsCode and devcontainer

lg.lindstrom
Posts: 48
Joined: Fri Sep 17, 2021 4:02 pm

VsCode and devcontainer

Postby lg.lindstrom » Wed Feb 01, 2023 8:18 am

Hi
I having a ESP-IDF project on a Windows 11 PC,,, running VsCode and ESP-IDF

For different reasons I decided to try out remote development using VsCode devcontainer.

Setting up everything was a smooth process. Only problem I had was that Linus is case sensitive on filenames so I needed to change some file name references in my source code.

But,, always a but :)

In my CMakeList.txt files I use this kind of constructs to pass in environment variables:

Code: Select all

idf_build_set_property(COMPILE_OPTIONS "-DTEST_WIFI_SSID=$ENV{TEST_WIFI_SSID}" APPEND)
This works in Windows 11,,, but not in Linux(devcontainer).

I created a "test" to show this,,,, by adding a line in my main.cpp.

Code: Select all

ESP_LOGI("c_MAIN", "Creating app %s", TEST_WIFI_SSID);
In devcontainer I get this error:
/workspaces/mdcb/main/app_main.cpp: In function 'void app_main()': /workspaces/mdcb/main/app_main.cpp:25:38: error: 'TEST_WIFI_SSID' was not declared in this scope 25 | ESP_LOGI("c_MAIN", "Creating app %s",TEST_WIFI_SSID);
In windows this will not happen.

To be sure that cmake have access to the environment variable, I added a printout in CMakeList.txt
message(STATUS "##################COMPILING FOR WIFI : " "$ENV{TEST_WIFI_SSID}")

This works showing that cmake have access to the environment variable.

I can see in the q++ output that the variable is not transferred to the compiler,, -DTEST_WIFI_SSID is missing.

So,, my conclusion is that "idf_build_set_property" differs between Windows 11 and Linux(devcontainer).

Can anyone confirm/deny suggest fix,,,???

lg.lindstrom
Posts: 48
Joined: Fri Sep 17, 2021 4:02 pm

Re: VsCode and devcontainer

Postby lg.lindstrom » Wed Feb 01, 2023 6:03 pm

Solved. My fault,, stupid me..
But it helps formulate the problem.

Who is online

Users browsing this forum: No registered users and 10 guests