Я успешно использовал SDL для изучения OpenGL, однако я следую учебным пособиям, использующим GLUT, и я попытался переключиться на GLUT, потому что он выглядит проще для новичков, и я чувствую, что я бы выбрал быстрее. Я думал, что это будет простой быстрый и безболезненный процесс, однако я пытаюсь скомпилировать контент GLUT (используя MinGW) (я загрузил GLUT и извлек файл заголовка к моему включению, поэтому он включен правильно, и я также извлек файлы lib в папку lib, и я связываюсь с ним, DLL для перенасыщения присутствует в моей системе32, поэтому он называется успешно.Неопределенные ссылки с использованием GLUT
Я не знаю, что Я делаю неправильно, и был бы признателен за любую помощь и предложения
сообщения Построить при компиляции следующую небольшую часть содержимого (который не будет ничего делать в тот момент, но компилируется):
#include <stdlib.h>
#include <GL/glut.h>
static int day = 0, year = 0;
void init()
{
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glPushMatrix();
glutWireSphere(1.0,20,16);
glRotatef((GLfloat) year, 0.0,1.0,0.0);
glTranslatef(2.0,0.0,0.0);
glRotatef((GLfloat) day, 0.0, 1.0, 0.0);
glutWireSphere(0.2,10,8);
glPopMatrix();
glutSwapBuffers();
}
//void reshape(int w, int h)
int main(int argc, char **argv)
{
}
Builder Ошибка:
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `__glutInitWithExit'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `__glutCreateWindowWithExit'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `__glutCreateMenuWithExit'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glClearColor'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glShadeModel'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glClear'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glColor3f'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glPushMatrix'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `glutWireSphere'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glRotatef'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glTranslatef'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glRotatef'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `glutWireSphere'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `_imp__glPopMatrix'|
C:\Documents and Settings\User\Desktop\test.o:test.cpp|| undefined reference to `glutSwapBuffers'|
||=== Build finished: 15 errors, 0 warnings ===|
Я использую CodeBlocks, я получил заголовки и библиотеки и DLL-файл с HTTP: // пользователь .xmission.com/~ nate/glut.html и моя CodeBlocks IDE настроена для ссылки на следующие: -lmingw32 -lSDLmain -lSDL -lSDL_ttf -lSDL_image -lglut32 -lopengl32 -lglu32 -lglut32win –
Смотрите мои правки. Кстати, если это вариант, я бы подумал о разработке в поле * nix, потому что установка библиотек безболезненна и происходит через диспетчер пакетов. –
Благодарим вас за помощь, ваш отредактированный ответ предоставил решение, подумал я. Возможно, он связан как .lib. Также мне нужно было включить windows.h перед glut.h. Еще раз спасибо! –