protobufs icon indicating copy to clipboard operation
protobufs copied to clipboard

MSVC 2022 compile error

Open hexabyte23 opened this issue 10 months ago • 2 comments

Hi all,

Trying to compile C++ protobuf classes with MSVC 2022 Community, get this :

....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1299): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1299): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1299): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1299): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1299): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1299): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1300): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1300): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1300): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1300): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1300): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1300): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1300): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1301): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1301): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1301): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1301): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1301): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1301): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1301): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1302): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1302): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1302): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1302): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1302): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1302): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1302): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1303): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1303): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1303): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1303): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1303): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1303): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1303): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1304): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1304): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1304): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1304): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1304): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1304): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1304): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1305): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1305): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1305): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1305): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1305): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1305): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1305): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1306): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1306): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1306): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1306): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1306): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1306): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1306): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1307): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1307): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1307): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1307): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1307): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1307): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1307): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1308): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1308): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1308): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1308): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1308): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1308): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1308): error C2238: unexpected token(s) preceding ';' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1309): error C2143: syntax error: missing ')' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1309): error C2143: syntax error: missing ';' before 'constant' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1309): error C2737: 'meshtastic::ModuleConfig_SerialConfig::DWORD': constexpr object must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1309): error C2789: 'meshtastic::ModuleConfig_SerialConfig::DWORD': an object of const-qualified type must be initialized ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1309): note: see declaration of 'meshtastic::ModuleConfig_SerialConfig::DWORD' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1309): error C2059: syntax error: ')' ....\thirdparty\Meshtastic\generated\meshtastic/module_config.pb.h(1309): error C2238: unexpected token(s) preceding ';'

Missing some compiler flags ?

Thanks

hexabyte23 avatar Jan 19 '25 12:01 hexabyte23

Can I ask how you went about compiling the protobufs for C#? Or was there a nuget package you used?

danditomaso avatar Jan 19 '25 13:01 danditomaso

Its C++ files generated by regular protoc tool, no C# here.

hexabyte23 avatar Jan 19 '25 17:01 hexabyte23