1 년 동안 Python으로 작업을 시작했고 C++을 시작 했으므로 나는 멍청한 행동입니다. MinGW를 설치하고 freeglut을 설치할 때까지 모든 것이 잘 작동하도록했습니다. 사용MinGW 및 GLUT에서 '_imp ____ glutInitWithExit @ 12'에 대한 정의되지 않은 참조
#include <gl/glut.h>
int main()
{
return 0;
}
: 나는 다음과 같은 코드를 실행하면
C:\code\cpp>g++ GLtest1.cpp
을 나는이 얻을 :
C:\Users\User\AppData\Local\Temp\ccABWOyv.o:GLtest1.cpp:(.text+0x1c): undefined
reference to `[email protected]'
C:\Users\User\AppData\Local\Temp\ccABWOyv.o:GLtest1.cpp:(.text+0x3e): undefined
reference to `[email protected]'
C:\Users\User\AppData\Local\Temp\ccABWOyv.o:GLtest1.cpp:(.text+0x60): undefined
reference to `[email protected]'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\U
ser\AppData\Local\Temp\ccABWOyv.o: bad reloc address 0x20 in section `.eh_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
I 설치하고 문제를 해결하기위한 시도는 MinGW을 여러 번 재설치 , 그러나 아무 소용이 없습니다. 사용해 보았습니다.
#include <windows.h>
도 있습니다. 나는 64 비트 .dll 파일을 설치하려고 시도했다. 이전에 경험이 있거나 내 문제에 익숙하면 도움을받을 수 있습니다. 고맙습니다. 나는 "링크"로 뭔가를 할 필요가 있다고 생각하지만 실제로 "glut.h"가 "gl.h"또는 "glu.h"와 다른 이유를 실제로 알지 못합니다. 너무 멋지다!
는 업데이트 :
나는 몇 가지를 연결하려고했습니다. 먼저이 작업을 수행했습니다.
C:\code\cpp>g++ -c -o GLtest1.exe GLtest1.cpp -I"C:\MinGW\include"
괜찮 았습니다. 오류 없음. 그런 다음 상황을 연결하려고 시도하여 오류가 발생했습니다.
C:\code\cpp>g++ -o GLtest1.exe -L"C:\MinGW\lib" -lglut32 -opengl32
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot fin
d -lglut32
collect2.exe: error: ld returned 1 exit status
여기에 아이디어가 있습니까? glut32.dll는 SYSTEM32와 SysWOW64와
당신은 바이너리 과잉 링크해야
dll 파일은 동적으로로드되는 라이브러리 (런타임 중에 필요함)입니다. 앱을 링크 할 때 정적 라이브러리 (확장자가 .a 또는 .lib 인 파일)에 링크해야합니다. -L 스위치를 사용하여 정적 라이브러리를 찾을 위치를 컴파일러에 알릴 수 있습니다 (헤더의 경우 -I와 유사). – tumdum