BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
303 stars 38 forks source link

'index' is not a constant expression when changing main.c to main.cpp #231

Closed nattrass closed 12 months ago

nattrass commented 1 year ago

The readme states that if we want to use c++ it's just a case of renaming the main.c to main.cpp.

But when I do this I get the following error on line 262 for the following function during compilation.

'index' is not a constant expression

__attribute__((always_inline)) inline USHORT* copSetColor(USHORT* copListCurrent, USHORT index,USHORT color) {
    *copListCurrent++=offsetof(struct Custom, color[index]);
    *copListCurrent++=color;
    return copListCurrent;
}
BartmanAbyss commented 12 months ago

Thanks for noticing. Seems to have changed when gcc was updated. I have fixed it for C++. You can grab the new main.c here until I release a new version: https://github.com/BartmanAbyss/vscode-amiga-debug/commit/6d815baea3da14673e1a5af70d9505b3c3905563