Giter Site home page Giter Site logo

Comments (6)

Dav1dde avatar Dav1dde commented on May 22, 2024

Thanks, I will take a look. I assume you're using it for the D programming language? Are you using the latest version I fixed a bug like that in the last commit.

from glad.

Dav1dde avatar Dav1dde commented on May 22, 2024

Can you give me some more information, I tried to reproduce this, but everything I try seems to compile, e.g.:

─[dav1d@archbox][~/workspaces/d/glad]╼ python2 main.py --out-path=./build --generator=d                                                                                          1 ↵  ✭master 
Using local spec: gl.xml
Generating gl bindings...
─[dav1d@archbox][~/workspaces/d/glad]╼ dmd -Ibuild build/glad/gl/* -L-ldl                                                                                                             ✭master 
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: Fehler: ld gab 1 als Ende-Status zurück
--- errorlevel 1

The last error message means, there is simply no main function, linking failed (expected), but compilation succeeded.

Can you give me the command you use to compile your code and the command which you used to generate the loader?

Thanks

from glad.

JarrettBillingsley avatar JarrettBillingsley commented on May 22, 2024

Ah, sorry about that.

I'm using the C binding actually, but with one important distinction: I'm compiling the resulting .c file as C++ instead of C. Apparently C doesn't care that there are multiple definitions of these things, but C++ is more strict.

The loader generator command:

python main.py --profile=compatibility --out-path=testloader --api="gl=" --generator=c --spec=gl

Then I rename testloader/src/glad.c to glad.cpp, and compile:

gcc testloader/src/glad.cpp -I./testloader/include

from glad.

0x1100 avatar 0x1100 commented on May 22, 2024

The three last extensions are also written against plain OpenGL, so there's nothing wrong about them getting loaded:
https://www.opengl.org/registry/specs/EXT/geometry_shader4.txt
https://www.opengl.org/registry/specs/EXT/separate_shader_objects.txt
https://www.opengl.org/registry/specs/EXT/direct_state_access.txt

Concerning the compilation error you encounter, this is not valid C++ code. (3.2 One definition rule)
However, this is valid C code since those are all tentative definitions. (6.9.2 External object definitions)
Glad supplies a C binding that requires a C compiler. I see no bug.

Why would you want to compile it with a C++ compiler?

from glad.

Dav1dde avatar Dav1dde commented on May 22, 2024

With latest commit, C++ should be supported. My small tests run through and @pyalot uses it in a bigger C++ project.

from glad.

Dav1dde avatar Dav1dde commented on May 22, 2024

Ok now it is really fixed, thanks everyone!

from glad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.