xlab / c-for-go

Automatic C-Go Bindings Generator for Go Programming Language
https://c.for-go.com
MIT License
1.5k stars 119 forks source link

Errors on std headers #79

Closed nazzrim closed 5 years ago

nazzrim commented 5 years ago

I want to create a wrapper for cimgui but wasn't able to get c-for-go to run.

I am using a win10 x64 machine with mingw64.

Here are some commands I tried and the corresponding output:

c-for-go -out . cimgui.yml

  processing cimgui.yml ⠋[ERR] cimgui\cimgui.h:5:10: include file not found: stdio.h. Search paths:
        ...\go\src\github.com\nazzrim\imgui-go
        ...\go\src\github.com\nazzrim\imgui-go (and 4 more errors)

c-for-go -out . --ccincl cimgui.yml

  processing cimgui.yml ⠙[ERR] C:\MinGW\mingw64\x86_64-w64-mingw32\include\_mingw.h:271:2: error: "Only Win32 target is supported!" (and 2 more errors)

c-for-go -out . --ccdefs cimgui.yml

  processing cimgui.yml ⠋[ERR] cimgui\cimgui.h:5:10: include file not found: stdio.h. Search paths:
        ...\go\src\github.com\nazzrim\imgui-go
        ...\go\src\github.com\nazzrim\imgui-go (and 4 more errors)

c-for-go -out . --ccdefs --ccincl cimgui.yml

  processing cimgui.yml ⠙C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:789:35: undefined: __builtin_va_start
C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:789:35: called object is not a function or function pointer (have '<undefined>')
C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:791:3: undefined: __builtin_va_end
C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:791:3: called object is not a function or function pointer (have '<undefined>')
C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:1203:5: undefined: __builtin_va_start
C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:1203:5: called object is not a function or function pointer (have '<undefined>')
C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:1205:5: undefined: __builtin_va_end
C:\MinGW\mingw64\x86_64-w64-mingw32\include\stdio.h:1205:5: called object is not a function or function pointer (have '<undefined>')
C:\MinGW\mingw64\x86_64-w64-mingw32\include\swprintf.inl:39:3: undefined: __builtin_va_start
C:\MinGW\mingw64\x86_64-w64-mingw32\include\swprintf.inl:39:3: called object is not a function or function pointer (have '<undefined>')
too many errors

I thought this may be related to #49 and was wondering if this would work on linux. So I set up a Ubuntu 18.04.3 LTS vm, installed cland, and tried it again.

I got similar errors regarding missing header files (/usr/include was set as include path) and when I tried with --ccincl --ccdefs I got the following error:

cimgui.h@898:44 unexpected identifier vec, expected one of [')', ',', ...]

The error corresponds to this line:

inline ImVec2_Simple ImVec2ToSimple(ImVec2 vec)

nazzrim commented 5 years ago

I was able to fix the above error on my windows machine with the following defines.

  Defines:
    __builtin_va_start: {}
    __builtin_va_end: {}

But sadly I now get the same error as on unix:

processing .\cimgui.yml ⠙[ERR] cimgui\cimgui.h:898:44: unexpected identifier vec, expected one of [')', ',', ...]

xlab commented 5 years ago

Thanks, this will be incorporated in a patch