Skip to content

[qt examples] lld-link: error: undefined symbol of opengl functions #40

@miyanyan

Description

@miyanyan

platform:
win11 + clang-cl + qt5.15.2
or
win11 + msvc + qt5.15.2

all qt examples got such errors:

[build] LINK: command "C:\PROGRA~1\MICROS~3\2022\COMMUN~1\VC\Tools\Llvm\x64\bin\lld-link.exe /nologo examples\qt\graph1\CMakeFiles\qtgraph1.dir\qtgraph1_autogen\mocs_compilation.cpp.obj examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj /out:examples\qt\graph1\qtgraph1.exe /implib:examples\qt\graph1\qtgraph1.lib /pdb:examples\qt\graph1\qtgraph1.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console C:\Qt\5.15.2\msvc2019_64\lib\Qt5OpenGL.lib C:\Qt\5.15.2\msvc2019_64\lib\Qt5Widgets.lib C:\Qt\5.15.2\msvc2019_64\lib\Qt5Gui.lib C:\Qt\5.15.2\msvc2019_64\lib\Qt5Core.lib D:\github\vcpkg\installed\x64-windows\lib\freetype.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=1" failed (exit code 1) with the following output:
[build] lld-link: error: undefined symbol: __declspec(dllimport) glGetError
[build] >>> referenced by examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj:(unsigned int __cdecl mplot::gl::Util::checkError(char const *, int))
[build] >>> referenced by examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj:(unsigned int __cdecl mplot::gl::Util::checkError(char const *, int))
[build] >>> referenced by examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj:(unsigned int __cdecl mplot::gl::LoadShaders(class std::vector<struct mplot::gl::ShaderInfo, class std::allocator<struct mplot::gl::ShaderInfo>> const &))
[build] 
[build] lld-link: error: undefined symbol: glCreateProgram
[build] >>> referenced by examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj:(unsigned int __cdecl mplot::gl::LoadShaders(class std::vector<struct mplot::gl::ShaderInfo, class std::allocator<struct mplot::gl::ShaderInfo>> const &))
[build] 
[build] lld-link: error: undefined symbol: __declspec(dllimport) glGetBooleanv
[build] >>> referenced by examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj:(unsigned int __cdecl mplot::gl::LoadShaders(class std::vector<struct mplot::gl::ShaderInfo, class std::allocator<struct mplot::gl::ShaderInfo>> const &))
[build] 
[build] lld-link: error: undefined symbol: glCreateShader
[build] >>> referenced by examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj:(unsigned int __cdecl mplot::gl::LoadShaders(class std::vector<struct mplot::gl::ShaderInfo, class std::allocator<struct mplot::gl::ShaderInfo>> const &))
[build] 
[build] lld-link: error: undefined symbol: glShaderSource
[build] >>> referenced by examples\qt\graph1\CMakeFiles\qtgraph1.dir\main.cpp.obj:(unsigned int __cdecl mplot::gl::LoadShaders(class std::vector<struct mplot::gl::ShaderInfo, class std::allocator<struct mplot::gl::ShaderInfo>> const &))

I tried to link Qt5::OpenGL instead, it also doesn't work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions