提问人:Alex 提问时间:3/27/2023 最后编辑:Alex 更新时间:3/27/2023 访问量:407
Raylib 库在 C++ 项目中未正确链接
Raylib Library is not linking correctly in C++ project
问:
当我编译时,我收到这些编译器错误gcc -g -o main.exe -Wall -std=c++11 -I./include/ -L./lib main.cpp -o main.exe -lraylib
C:\mingw-w64\bin/ld.exe: C:\Users\usr\AppData\Local\Temp\ccjms0zo.o: in function `_tcf_0':
c:/mingw-w64/lib/gcc/i686-w64-mingw32/12.1.0/include/c++/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
C:\mingw-w64\bin/ld.exe: C:\Users\usr\AppData\Local\Temp\ccjms0zo.o: in function `_static_initialization_and_destruction_0':
c:/mingw-w64/lib/gcc/i686-w64-mingw32/12.1.0/include/c++/iostream:74: undefined reference to `std::ios_base::Init::Init()'
collect2.exe: error: ld returned 1 exit status
我已经尝试重新链接并重新安装库。我还遵循了许多关于如何安装 Raylib 的教程。我尝试了不同的标志.我只是得到不同的错误g++ main.cpp -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
C:\mingw-w64\bin/ld.exe: cannot find -lGL: No such file or directory
C:\mingw-w64\bin/ld.exe: cannot find -ldl: No such file or directory
C:\mingw-w64\bin/ld.exe: cannot find -lrt: No such file or directory
C:\mingw-w64\bin/ld.exe: cannot find -lX11: No such file or directory
collect2.exe: error: ld returned 1 exit status
答: 暂无答案
评论
-I./include
-L./lib
g++ main.cpp -lraylib -I./include -L./lib -lGL -lm -lpthread -ldl -lrt -lX11