Can't get build_flags to compile without error

I’m trying at least 2 hours to get this to work. Did read doc and a lot of forum posts here, no success
my enviorement Mac OS Ventura latest patches, vscode/platformio latest version
platformio.ini

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino

monitor_speed = 115200

; Build options
build_flags =
	-DSSID_NAME=HELLO
; tried -DSSID_NAME="HELLO"
;tried -D SSID_NAME=HELLO and with quotest too

main.cpp

#include <Arduino.h>

// put function declarations here:
int myFunction(int, int);

void setup() {
	// put your setup code here, to run once:
	//int result = myFunction(2, 3);
	Serial.begin(112500);
	delay(500);
	Serial.print(String(SSID_NAME));
     // tried Serial.print(SSID_NAME);
    // tried Serial.print("SSID_NAME"); compile but have not expected result
}

my be I am stupid, but I have no more Ideas
Need help, Thanks

Hi @muekno, take a look at this doc page build_flags — PlatformIO latest documentation

There are two ways to get it work:

  1. enclose the whole line in single quotation marks
build_flags=
  '-D SSID_NAME="Hello"'
  1. escaping the double quotes
build_flags=
  -D SSID_NAME=\"Hello\"

Thank you, escaping with single quotes did not work, I tried it bevor, but escapingwith backslash works fine.

Did you enclose the complete line with single quotes and the string with double quotes as shown above? This should work and my test compiled fine.

Not that the complete line must be enclosed including -D and so on.

I missed this when i read the documentation mentioned by valeros.

Now it works both methods, do not know was was wrong earlier
Thank you

Sorry me again, may be a C++ question
platformio.ini

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino

monitor_speed = 115200

; Build options
build_flags =
	-DSSID_NAME=\"HELLO\"
	'-DPASSWD=" Word/something"'
	'-DMQTT_TEMPERATURE_TOPIC="Wohnung/KUE/get/temperature"'
	-DMONITOR_SPEED=115200

main.cpp

#include <Arduino.h>

// put function declarations here:

int myFunction(const char *topic, int);
void function2(const char *topic);
void setup()
{
	// put your setup code here, to run once:
	//int result = myFunction(2, 3);
	Serial.begin(MONITOR_SPEED);
	delay(1000);
	Serial.println();
	Serial.println(String(SSID_NAME));
	Serial.println(String(SSID_NAME) + String(PASSWD));
	Serial.println(String(MQTT_TEMPERATURE_TOPIC));
	function2(MQTT_TEMPERATURE_TOPIC);
}

void loop() {
	int x=0;
	// put your main code here, to run repeatedly:
	function2(MQTT_TEMPERATURE_TOPIC);
	//	int myFunction(MQTT_TEMPERATURE_TOPIC, x);
	delay(5000);
}

// put function definitions here:
int myFunction(const char *topic, int x)
{
	Serial.print("topic ");
	Serial.print(x);
	Serial.print(" : ");
	x++;
	Serial.println(topic);
	return x;
}

void function2(const char *topic)
{
	Serial.print("topic: ");
	Serial.println(topic);
}

if I uncoment one of the function calls in loop() I get errors
if I comment both it compiles and runs as expected. Why does the call from setup work but gives errors in loop

You can find a good explanation from maxgerhard here: Beginner who wants to migrate to platformIO but a lot of things that I do not understand (my sketch works on Arduino IDE) - #4 by maxgerhardt

Thats not the problem and I am not so new to platformio.
If you look at my code, both function are declared on top of the code.
Like in the skeleton og a new project. if they were not declared they would not run from setup.

Sorry I got it
the function call in loop was wrong

Sorry, then it was a misunderstanding on my part.