C ++: strange error "expected initializer before extern" in the SDL_image.h library

I'm currently trying to make a simple game with SDL and Box2D. Unfortunately, the code I added to get the characters to shoot proyectiles is so buggy that I can’t even count the errors. To handle this, I added code to display some debugging information in the game. Unfortunately, after fixing all the errors, a strange error occurred that did not appear before:

/usr/include/SDL/SDL_image.h|34|error: expected initializer before 'extern'| ||=== Build finished: 1 errors, 0 warnings ===| 

Code in SDL_image.h that calls this:

 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif 

I have no idea why this error message appears or how to solve it. There are no error messages in my code. I don’t think that something is wrong with the library, because in another game I just compiled the file. This is the only error that appears.

+6
source share
1 answer

Look at the end of the header files that were included before. I assume that after class definition is missing ; .

+21
source

Source: https://habr.com/ru/post/893883/


All Articles