Skip to content

mosquitto: ISO C++ forbids converting a string constant to 'char*' (IDFGH-15418) #816

Open
@0xFEEDC0DE64

Description

@0xFEEDC0DE64

Answers checklist.

  • I have read the documentation for esp-protocols components and the issue is not addressed there.
  • I have updated my esp-protocols branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

What component are you using? If you choose Other, provide details in More Information.

Other

component version

always using latest master

IDF version.

also using latest master

More Information.

please add a const to char* pointers :)

/mqtt_server.cpp:32:17: error: ISO C++ forbids converting a string constant to 'char*' [-Werror=write-strings]
   32 |         .host = "0.0.0.0",  // Listen on all interfaces
      |                 ^~~~~~~~~
cc1plus: some warnings being treated as errors
ninja: build stopped: subcommand failed.

I want to try the mosquitto server but it seems like the most basic example already doesnt compile

namespace {
void mqtt_server_task(void*)
{
    struct mosq_broker_config config = {
        .host = "0.0.0.0",  // Listen on all interfaces
        .port = 1883,       // Standard MQTT port
        .tls_cfg = NULL     // No TLS in this example
    };

    mosq_broker_run(&config);
}
} // namespace

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions