Talk:c/language/struct initialization

Failed to build with ERROR message: expected primary-expression before ‘.’ token

I'm using gcc 11.2.0 under Ubuntu 22.04.

It looks this version of gcc 11.2.0 won't be able to compile that particular ., which is from a .cpp file, rather than .c file.

Can anybody please help to build the following code through ??

-- that's a C program, not a C++ program. GCC will attempt to use C++ by default if you give it a .cpp file. unless you override with --Cubbi (talk) 10:04, 1 August 2022 (PDT)

-- Thank you for the prompt reply. I understand now. However, refer to. I was actually trying to build Filament,, this PostProcessManager.cpp does come with the struct/union initialization in C-style. Filament's google developer said: they can build everything successfully with CLANG. Anyway, is there a way to build this C-Style struct/union initialization with C++ compiler?

I also found

Jiapei100 (talk) 10:11, 1 August 2022 (PDT)


 * right, the "See also" link at the bottom of this page leads to the C++ page that describes the rules of the similar feature in that language (specifically, in cpp/language/aggregate_initialization). Several compilers supported some variants of that as a language extension for many years until they finally agreed on what exactly they are supporting, in C++20 --Cubbi (talk) 11:54, 1 August 2022 (PDT)