Skip to content

src_build_flags parsing error #2256

@dontsovcmc

Description

@dontsovcmc

[x ] PlatformIO Core

Configuration

Operating system: Windows 10

PlatformIO Version 3.6.5

Description of problem

I want to define URL, but I can't

Different variants:

src_build_flags = -D TEST_VAR=https://platformio.org  // result: https:
src_build_flags = -D TEST_VAR=https:\/\/platformio.org // https:
src_build_flags = -D TEST_VAR="https://platformio.org" // https:
src_build_flags = -D TEST_VAR=https:platformio.org // https:platformio.org
src_build_flags = -D TEST_VAR=https:/platformio.org // https:/platformio.org
src_build_flags = -D TEST_VAR="https:\/\/platformio.org" //warning: unknown escape sequence: '\/'

If problems with PlatformIO Build System:

The content of platformio.ini:

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


src_build_flags = -D TEST_VAR="https://platformio.org"

Source file to reproduce issue:

#include <Arduino.h>

#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "="  VALUE(var)


void setup() {
    Serial.begin(9600);
    while(!Serial)
      ;
    
    #pragma message(VAR_NAME_VALUE(TEST_VAR))
    String key = VALUE(TEST_VAR);
    Serial.print(key);
}

void loop() {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions