Godot: GDNative build error with MSVC

Created on 17 Sep 2017  路  6Comments  路  Source: godotengine/godot

  • Godot 3.0 fba938e5740c017fa2d6180c15cae852608ad701
  • Windows 10
  • Detected MSVC compiler: amd64 (Visual Studio 2015 installed)

Getting this error:
modules\gdnative\gdnative.cpp(47): error C2059: syntax error: '.' modules\gdnative\gdnative.cpp(48): error C2143: syntax error: missing ';' before '}' modules\gdnative\gdnative.cpp(48): error C2059: syntax error: '}'

Maybe the macro added here isn't working? https://github.com/godotengine/godot/commit/8d57a3f3d5e6785d516f7709f6f666a603ef557e#diff-e64435d26a3330d5e6313e9be3784cad

Sorry thought it was an obvious error and didn't need more information.

bug gdnative

Most helpful comment

Seems to be a redefinition problem. Replacing
https://github.com/godotengine/godot/blob/8d57a3f3d5e6785d516f7709f6f666a603ef557e/modules/gdnative/gdnative.cpp#L43-L51
with
const godot_gdnative_api_struct api_struct;
resolves the compilation problem.

All 6 comments

There's an issue template for a reason... Missing mandatory information:

  • Version of Godot (commit)
  • OS
  • Compiler

Yes, an experienced dev can guess it all from the backslashes as directory separator, the style and error numbers of the compilation errors (though that doesn't give the version, only the compiler), and the reference to a macro merged today in the master branch, but why should we be doing all the work? :)

CC @karroffel @touilleMan

Mayyyyyyyybe it doesn't like https://github.com/godotengine/godot/blob/8d57a3f3d5e6785d516f7709f6f666a603ef557e/modules/gdnative/include/gdnative_api_struct.h#L712

C compilers don't like that, so just typdef struct { ... } struct_name; would be better in any case.

I'm not sure if that is what is the problem here, but that should be fixed anyway 馃槢

I used typedef struct xxx { ... } xxx; format to be able to create a forward declaration of this structure in https://github.com/godotengine/godot/blob/8d57a3f3d5e6785d516f7709f6f666a603ef557e/modules/gdnative/include/gdnative/gdnative.h#L237

Is changing the struct and typedef names would fix this issue ?

Seems to be a redefinition problem. Replacing
https://github.com/godotengine/godot/blob/8d57a3f3d5e6785d516f7709f6f666a603ef557e/modules/gdnative/gdnative.cpp#L43-L51
with
const godot_gdnative_api_struct api_struct;
resolves the compilation problem.

This was fixed long ago :)

Was this page helpful?
0 / 5 - 0 ratings