bullet3 icon indicating copy to clipboard operation
bullet3 copied to clipboard

Failed to link Gwen using mingw-clang14

Open reglnk opened this issue 1 year ago • 1 comments

Gwen is missing symbols from GLAD. Temporary fix for this: compile /examples/ThirdPartyLibs/glad/gl.c manually and include in objects1.rsp in gwen.dir. CMake log:

$ make
Built target LinearMath
Built target BulletCollision
Built target BulletDynamics
Scanning dependencies of target App_HelloWorld
Consolidate compiler generated dependencies of target App_HelloWorld
Building CXX object examples/HelloWorld/CMakeFiles/App_HelloWorld.dir/HelloWorld.obj
Building RC object examples/HelloWorld/CMakeFiles/App_HelloWorld.dir/__/__/build3/bullet.obj
Linking CXX executable App_HelloWorld.exe
Built target App_HelloWorld
Scanning dependencies of target App_BasicExample
Consolidate compiler generated dependencies of target App_BasicExample
Building CXX object examples/BasicDemo/CMakeFiles/App_BasicExample.dir/BasicExample.obj
Building CXX object examples/BasicDemo/CMakeFiles/App_BasicExample.dir/main.obj
Building RC object examples/BasicDemo/CMakeFiles/App_BasicExample.dir/__/__/build3/bullet.obj
Linking CXX executable App_BasicExample.exe
Built target App_BasicExample
Built target Bullet3Common
Built target OpenGLWindow
Scanning dependencies of target AppBasicExampleGui
Consolidate compiler generated dependencies of target AppBasicExampleGui
Building CXX object examples/BasicDemo/CMakeFiles/AppBasicExampleGui.dir/BasicExample.obj
Building RC object examples/BasicDemo/CMakeFiles/AppBasicExampleGui.dir/__/__/build3/bullet.obj
Building CXX object examples/BasicDemo/CMakeFiles/AppBasicExampleGui.dir/__/StandaloneMain/main_opengl_single_example.obj
Building CXX object examples/BasicDemo/CMakeFiles/AppBasicExampleGui.dir/__/ExampleBrowser/OpenGLGuiHelper.obj
Building CXX object examples/BasicDemo/CMakeFiles/AppBasicExampleGui.dir/__/ExampleBrowser/GL_ShapeDrawer.obj
Building CXX object examples/BasicDemo/CMakeFiles/AppBasicExampleGui.dir/__/ExampleBrowser/CollisionShape2TriangleMesh.obj
Building CXX object examples/BasicDemo/CMakeFiles/AppBasicExampleGui.dir/__/Utils/b3Clock.obj
Linking CXX executable AppBasicExampleGui.exe
Built target AppBasicExampleGui
Built target BulletSoftBody
Built target BussIK
Built target BulletInverseDynamics
Built target BulletInverseDynamicsUtils
Linking CXX shared library ..\..\..\lib\libgwen.dll
ld.lld: error: undefined symbol: glad_glAlphaFunc
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glAlphaFunc)

ld.lld: error: undefined symbol: glad_glColor4ubv
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glColor4ubv)

ld.lld: error: undefined symbol: glad_glColorPointer
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glColorPointer)

ld.lld: error: undefined symbol: glad_glEnableClientState
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glEnableClientState)

ld.lld: error: undefined symbol: glad_glGetTexEnviv
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glGetTexEnviv)

ld.lld: error: undefined symbol: glad_glLoadIdentity
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glLoadIdentity)

ld.lld: error: undefined symbol: glad_glMatrixMode
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glMatrixMode)

ld.lld: error: undefined symbol: glad_glOrtho
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glOrtho)

ld.lld: error: undefined symbol: glad_glPopAttrib
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glPopAttrib)

ld.lld: error: undefined symbol: glad_glPopClientAttrib
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glPopClientAttrib)

ld.lld: error: undefined symbol: glad_glPopMatrix
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glPopMatrix)

ld.lld: error: undefined symbol: glad_glPushAttrib
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glPushAttrib)

ld.lld: error: undefined symbol: glad_glPushClientAttrib
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glPushClientAttrib)

ld.lld: error: undefined symbol: glad_glPushMatrix
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glPushMatrix)

ld.lld: error: undefined symbol: glad_glTexCoordPointer
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glTexCoordPointer)

ld.lld: error: undefined symbol: glad_glTexEnvi
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glTexEnvi)

ld.lld: error: undefined symbol: glad_glVertexPointer
>>> referenced by objects.a(OpenGL_DebugFont.obj):(.refptr.glad_glVertexPointer)
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [examples\ThirdPartyLibs\Gwen\CMakeFiles\gwen.dir\build.make:1170: lib/libgwen.dll] Error 1
make[1]: *** [CMakeFiles\Makefile2:1170: examples/ThirdPartyLibs/Gwen/CMakeFiles/gwen.dir/all] Error 2
make: *** [Makefile:145: all] Error 2

reglnk avatar Sep 21 '22 09:09 reglnk


#include <glad/glad.h>
#include <GLFW/glfw3.h>

int main() {
    // Initialize GLFW and create a window
    glfwInit();
    // Configure GLFW window hints here...

    GLFWwindow* window = glfwCreateWindow(800, 600, "My OpenGL Application", NULL, NULL);
    if (!window) {
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window);

    // Initialize GLAD (must be done after creating the context)
    if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
        // GLAD initialization failed
        return -1;
    }

    // Now you can use OpenGL functions

    // Rest of your code...

    glfwTerminate();
    return 0;
}

ljluestc avatar Jan 01 '24 18:01 ljluestc