[Iwao@fedora C4]$ cd C42
[Iwao@fedora C42]$ ll
合計 4
-rw-rw-r--. 1 Iwao Iwao 371  9月  6 16:24 c42.cpp
[Iwao@fedora C42]$ g++ c42.cpp
/usr/bin/ld: /tmp/ccTQ4zoh.o: in function `main':
c42.cpp:(.text+0x1e): undefined reference to `glutInit'
/usr/bin/ld: c42.cpp:(.text+0x28): undefined reference to `glutInitDisplayMode'
/usr/bin/ld: c42.cpp:(.text+0x37): undefined reference to `glutCreateWindow'
/usr/bin/ld: c42.cpp:(.text+0x41): undefined reference to `glutDisplayFunc'
/usr/bin/ld: c42.cpp:(.text+0x4b): undefined reference to `glutMainLoop'
/usr/bin/ld: /tmp/ccTQ4zoh.o: in function `display()':
c42.cpp:(.text._Z7displayv[_Z7displayv]+0xa): undefined reference to `glClear'
/usr/bin/ld: c42.cpp:(.text._Z7displayv[_Z7displayv]+0xf): undefined reference to `glFlush'
/usr/bin/ld: /tmp/ccTQ4zoh.o: in function `init()':
c42.cpp:(.text._Z4initv[_Z4initv]+0x1d): undefined reference to `glClearColor'
collect2: エラー: ld はステータス 1 で終了しました
[Iwao@fedora C42]$ g++ c42.cpp -lglut
/usr/bin/ld: /tmp/ccdmdVJ1.o: undefined reference to symbol 'glFlush'
/usr/bin/ld: //usr/lib64/libGL.so.1: error adding symbols: DSO missing from command line
collect2: エラー: ld はステータス 1 で終了しました
[Iwao@fedora C42]$ g++ c42.cpp -lglut -lGL
[Iwao@fedora C42]$ ./a.out
ウィンドウを塗りつぶす