Witam,
mam pewien problem:
otóż nie mogę odpalić kodu z tego tutoriala: http://cpp0x.pl/kursy/Kurs-OpenGL-C++/P … rogram/103
Dokładnie stworzyłem projekt (OpenGL project) i skopiowałem podany kod. (tak żeby zobaczyć czy działa mi coś w ogóle.)
kod który byl już po stworzeniu projektu działa fajnie (trojkącik sie wyswietlił), natomiast gorzej sprawa ma się z tym kodem skopiowanym:
-------------- Build: Debug in OpenGltest --------------- Compiling: main.c Linking console executable: bin\Debug\OpenGltest.exe obj\Debug\main.o: In function glutInit_ATEXIT_HACK': c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../include/GL/glut.h:486: undefined reference to
__glutInitWithExit’ obj\Debug\main.o: In function glutCreateWindow_ATEXIT_HACK': c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../include/GL/glut.h:503: undefined reference to
__glutCreateWindowWithExit’ obj\Debug\main.o: In function glutCreateMenu_ATEXIT_HACK': c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../include/GL/glut.h:549: undefined reference to
__glutCreateMenuWithExit’ obj\Debug\main.o: In function Display': C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:15: undefined reference to
_imp__glClearColor’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:18: undefined reference to _imp __glClear' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:21: undefined reference to
_imp__glColor3f’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:24: undefined reference to _imp__ glBegin' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:27: undefined reference to
_imp__glVertex3f’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:28: undefined reference to _imp __glVertex3f' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:29: undefined reference to
_imp__glVertex3f’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:30: undefined reference to _imp__ glVertex3f' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:33: undefined reference to
_imp__glEnd’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:36: undefined reference to _imp__glFlush' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:39: undefined reference to
glutSwapBuffers’ obj\Debug\main.o: In function main': C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:75: undefined reference to
glutInitDisplayMode’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:78: undefined reference to glutInitWindowSize' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:84: undefined reference to
glutDisplayFunc’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:87: undefined reference to glutReshapeFunc' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:95: undefined reference to
glutAddMenuEntry’ C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:102: undefined reference to glutAttachMenu' C:/Users/Piotruś/Documents/CodeBlocks/OpenGltest/main.c:105: undefined reference to
glutMainLoop’ collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 1 seconds) 21 errors, 0 warnings
To wyżej co podałem to Build Log.
Czy ktoś może mi powiedzieć co się stało? jak to rozwiązać?
pozdrawiam.
WOJEK64
(Wojtekbogocki)
23 Październik 2011 16:27
#2
Nie dolinkowałeś bibliotek, potrzebujesz opengl32, glu32 i glut32. Poza tym odradzam korzystania GLUT-a, GLFW jest znacznie leprze a przy tym wciąż rozwijane. Uczenia się OpenGL 2.0 też odradzam, lepiej od razu zacząć od VBO i Shaderów w OpenGL 3.x.
GL1zdA
(GL1zdA)
23 Październik 2011 17:02
#3
Menu Plugins - DevPack installer/updater.
W update server wybierz devpacks.org
W kategorii OpenGL kliknij prawym glut 3.7.6+ i wybierz download and install.
Zamiast projektu OpenGL wybierz projekt GLUT w CodeBlocks.
Nie mam tego w menu Plugins…
Druga sprawa to przy wybraniu typu projektu na GLUT program pyta się gdzie znajduje się ten GLUT. Ja wskazałem mu folder w którym jest plik glut32.lib i coś mu nie pasowało. Co mam tam wskazać?
GL1zdA
(GL1zdA)
24 Październik 2011 16:54
#5
Z tego co pamiętam, nie jest instalowana w domyślnej instalacji. Uruchom jeszcze raz setup Code::Blocks i wybierz ją. Ten lib, który wskazałeś jest dla Visual Studio, nie będzie działał z MinGW.
WOJEK64
(Wojtekbogocki)
24 Październik 2011 17:01
#6
Niby czemu? Pliki *.lib jak najbardziej działają w MinGW Robisz normalny projekcik OpenGL, następnie przechodzisz do Project -> Build options -> Linker settings -> Add (czy coś w tym guście), wywalasz te liby które już tam są i linkujesz kolejno opengl32, glu32 oraz to twoje nieszczęsne glut32.lib.
GL1zdA
(GL1zdA)
24 Październik 2011 18:15
#7
Nie wiem, mi z glut32.lib nie chciało się linkować. Zrobiłem jak kazali na forum Code::Blocks i działało:
http://forums.codeblocks.org/index.php? … 9#msg34619
glut32.lib nie działa:
http://forums.codeblocks.org/index.php? … 4#msg40974
WOJEK64:
Niby czemu? Pliki *.lib jak najbardziej działają w MinGW Robisz normalny projekcik OpenGL, następnie przechodzisz do Project -> Build options -> Linker settings -> Add (czy coś w tym guście), wywalasz te liby które już tam są i linkujesz kolejno opengl32, glu32 oraz to twoje nieszczęsne glut32.lib.
Uploaded with ImageShack.us
Zrobiłem to i ciągle nic Spróbuję jeszcze to co podał kolega post wyżej.
– Dodane 24.10.2011 (Pn) 21:02 –
I co ja mam teraz w tej sytuacji zrobić?
– Dodane 24.10.2011 (Pn) 21:08 –
dobra. Włożyłem glut.h do folderu GL w minGW ale teraz pokazuje inny błąd:
-------------- Build: Debug in Nastepnytest --------------- Linking console executable: bin\Debug\Nastepnytest.exe obj\Debug\main.o: In function glutInit_ATEXIT_HACK': c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../include/GL/glut.h:486: undefined reference to
__glutInitWithExit’ obj\Debug\main.o: In function glutCreateWindow_ATEXIT_HACK': c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../include/GL/glut.h:503: undefined reference to
__glutCreateWindowWithExit’ obj\Debug\main.o: In function glutCreateMenu_ATEXIT_HACK': c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../include/GL/glut.h:549: undefined reference to
__glutCreateMenuWithExit’ obj\Debug\main.o: In function Display': C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:15: undefined reference to
_imp__glClearColor’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:18: undefined reference to _imp __glClear' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:21: undefined reference to
_imp__glColor3f’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:24: undefined reference to _imp__ glBegin' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:27: undefined reference to
_imp__glVertex3f’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:28: undefined reference to _imp __glVertex3f' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:29: undefined reference to
_imp__glVertex3f’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:30: undefined reference to _imp__ glVertex3f' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:33: undefined reference to
_imp__glEnd’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:36: undefined reference to _imp__glFlush' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:39: undefined reference to
glutSwapBuffers’ obj\Debug\main.o: In function main': C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:75: undefined reference to
glutInitDisplayMode’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:78: undefined reference to glutInitWindowSize' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:84: undefined reference to
glutDisplayFunc’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:87: undefined reference to glutReshapeFunc' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:95: undefined reference to
glutAddMenuEntry’ C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:102: undefined reference to glutAttachMenu' C:/Users/piotrek/Documents/CodeBlocks Projects/Nastepnytest/main.c:105: undefined reference to
glutMainLoop’ collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 21 errors, 0 warnings
– Dodane 24.10.2011 (Pn) 21:21 –
DZIAŁA
dzięki temu: http://www.sci.brooklyn.cuny.edu/~goetz … ocks/glut/
pozostaje tylko pytanie: musiałem dodać w linii 14 #include oraz do widows/system musiałem wkleić glut32.dll. Czy to aby nie sprawi, że aplikacja będzie działała tylko u mnie, a na innych komputerach już nie? Będzie to działało na linuxie?
GL1zdA
(GL1zdA)
25 Październik 2011 06:27
#9
Przeinstalowałeś Code::Blocks i dodałeś DevPack plug-in? Jeśli nie, to hakując w taki sposób jak to zrobiłeś jesteś zależny zarówno od obecności glut32.dll jak i windows (importując windows.h).
Przeinstalowałem Code::Blocksa, sprawdzałem w menu plugins -> manage plugins , mam tego DevPacka jednak pisze że nie jest on jeszcze skonfigurowany. Program każe mi podać ścieżkę do tego DevPacka :? Co mam podać?
EDIT:
Działa Dzięki ci wielkie Musiałem coś wcześniej źle zrobić.