Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22016

Problem compiling DOOM source: error: initializer element is not constant (integer conversion) [duplicate]

$
0
0

I'm trying to get the original Doom code compiling.I already fixed some errors but I don't know what this means. I'm not that good at C...

Example error (there are more errors, but they're the same):

m_misc.c:249:40: note: (near initialization for ‘defaults[16].defaultvalue’)m_misc.c:250:42: error: initializer element is not constant  250 |         {"mousetype", (int *)&mousetype, (int)"microsoft"},      |                                          ^

As you can see it's marking the integer conversion.

This is the relevant part of the code. It's actually more, but it's repeating itself (more chat macro defining, etc.) so I shortened it a bit

typedef struct{    char *name;    int *location;    int defaultvalue;    int scantranslate; // PC scan code hack    int untranslated;  // lousy hack} default_t;default_t defaults[] ={    {"mousedev", (int *)&mousedev, (int)"/dev/ttyS0"},    {"mousetype", (int *)&mousetype, (int)"microsoft"},    {"chatmacro0", (int *)&chat_macros[0], (int)HUSTR_CHATMACRO0},    {"chatmacro1", (int *)&chat_macros[1], (int)HUSTR_CHATMACRO1},};

I'm using gcc 10.1.0-2 under Linux.

Thanks in advance for any help:)


Viewing all articles
Browse latest Browse all 22016

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>