c++ - non-trivial designated initializers not supported -


i rebuilding library , found error in section of code:

enum fix_version {     fix_4_0,     fix_4_1,     fix_4_2,     fix_4_3,     fix_4_4,     fix_5_0,     fixt_1_1, };  static const char *begin_strings[] = {         [fixt_1_1]  = "fixt.1.1",         [fix_4_4]   = "fix.4.4",         [fix_4_3]   = "fix.4.3",         [fix_4_2]   = "fix.4.2",         [fix_4_1]   = "fix.4.1",         [fix_4_0]   = "fix.4.0", }; 

the error receive is: sorry, unimplemented: non-trivial designated initializers not supported. have seen other examples of error, initializers struct , 1 simple char, how can solve this? code comes .c files , compiling in c++ through cmake.

thank in advance.

the equivalent c++ code this:

enum fix_version {     fix_4_0,     fix_4_1,     fix_4_2,     fix_4_3,     fix_4_4,     fix_5_0,     fixt_1_1 };  static const char *begin_strings[] = {         "fix.4.0",         "fix.4.1",         "fix.4.2",         "fix.4.3",         "fix.4.4",         0,         "fixt.1.1" }; 

this of course has risk forget fixing array when enum changes. c++ doesn't support designated array initializers.

the better option, explained in comment, leave library as is , compile c compiler. if has headers using extern "c" appropriate, can use directly c++ project. if not, place #includes library in extern "c" block.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -