OpenGL — связывание библиотек и библиотек glew и перенасыщения с g++C++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Anonymous
 OpenGL — связывание библиотек и библиотек glew и перенасыщения с g++

Сообщение Anonymous »

Я потратил буквально 5 часов, пытаясь скомпилировать код OpenGl с помощью g++.

Я попробовал так много вещей, что даже не могу вспомнить, чтобы опубликовать здесь. p>

Думаю, моя проблема заключается в связывании .libs и .dll с g++.

Я разместил все библиотеки и dll для glew и перенасыщения в папке под названием lib.
Последнее, что я сделал, это ввел эту команду:

Код: Выделить всё

g++ -I./include mytest1.cpp -L./lib
Все равно это не сработало. Любая помощь, пожалуйста?

РЕДАКТИРОВАТЬ:
Я использую Windows. Я не думаю, что использую FreeGlut, имя файла - Glut32.dll и Glut32.lib

Это ошибки компилятора:

Код: Выделить всё

C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x7): undefined
reference to `_imp____glewDeleteVertexArrays'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x22): undefined
reference to `_imp____glewDeleteBuffers'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x51): undefined
reference to `_imp____glewBindVertexArray'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x6a): undefined
reference to `_imp____glewBindBuffer'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x8b): undefined
reference to `_imp____glewBufferData'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xb4): undefined
reference to `_imp____glewEnableVertexAttribArray'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xc7): undefined
reference to `_imp____glewVertexAttribPointer'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x103): undefine
d reference to `_imp____glewBindBuffer'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x127): undefine
d reference to `_imp____glewBufferData'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x150): undefine
d reference to `_imp____glewEnableVertexAttribArray'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x163): undefine
d reference to `_imp____glewVertexAttribPointer'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x19f): undefine
d reference to `_imp____glewBindBuffer'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x1c3): undefine
d reference to `_imp____glewBufferData'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x206): undefine
d reference to `_imp____glewBindVertexArray'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x221): undefine
d reference to `_imp____glewBindVertexArray'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x265): undefine
d reference to `glDrawElements@16'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x26d): undefine
d reference to `_imp____glewBindVertexArray'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x28f): undefine
d reference to `glClear@4'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x2af): undefine
d reference to `glFlush@0'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x3e6): undefine
d reference to `_imp____glewUniformMatrix4fv'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x434): undefine
d reference to `glutPostRedisplay'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x581): undefine
d reference to `_imp____glewUniformMatrix4fv'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x5cf): undefine
d reference to `glutPostRedisplay'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x633): undefine
d reference to `glViewport@16'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x68e): undefine
d reference to `_imp____glewUniformMatrix4fv'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x718): undefine
d reference to `glClearColor@16'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x833): undefine
d reference to `_imp____glewGenVertexArrays'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x84e): undefine
d reference to `_imp____glewGenBuffers'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x906): undefine
d reference to `initshaders(unsigned int, char const*)'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x91f): undefine
d reference to `initshaders(unsigned int, char const*)'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x93b): undefine
d reference to `initprogram(unsigned int, unsigned int)'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x945): undefine
d reference to `_imp____glewGetUniformLocation'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x966): undefine
d reference to `_imp____glewGetUniformLocation'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x987): undefine
d reference to `_imp____glewUniformMatrix4fv'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0x9d5): undefine
d reference to `_imp____glewUniformMatrix4fv'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xa61):  undefine
d reference to `glutInit'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xa6d): undefine
d reference to `glutInitDisplayMode'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xa81): undefine
d reference to `glutInitWindowSize'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xa95): undefine
d reference to `glutInitWindowPosition'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xaa1): undefine
d reference to `glutCreateWindow'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xaa6): undefine
d reference to `_imp__glewInit@0'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xabc): undefine
d reference to `_imp__glewGetString@4'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xb05): undefine
d reference to `glutDisplayFunc'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xb11): undefine
d reference to `glutReshapeFunc'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xb1d): undefine
d reference to `glutKeyboardFunc'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xb29): undefine
d reference to `glutMouseFunc'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xb35): undefine
d reference to `glutMotionFunc'
C:\Users\User1\AppData\Local\Temp\cc219WZV.o:mytest1.cpp:(.text+0xb3a): undefine
d reference to `glutMainLoop'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\U
ser1\AppData\Local\Temp\cc219WZV.o: bad reloc address 0x20 in section `.text$_ZS
t4sqrtf[__ZSt4sqrtf]'
collect2.exe: error: ld returned 1 exit status
EDIT2: Содержимое папки lib:

Изображение


EDIT3:

Архитектура: 64-разрядная версия x64

Сведения о компиляторе (g++ -v):

Код: Выделить всё

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=m
ingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto
--enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++
,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-l
ibstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gm
p-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --
with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-
libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/
mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
Файлы были загружены из курса edx по OpenGL. Он использовал Visual Studio, но я не могу его использовать, потому что мой компьютер старый и у меня проблемы с драйверами, поэтому я пытаюсь скомпилировать все из командной строки

Подробнее здесь: https://stackoverflow.com/questions/618 ... lls-with-g
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C++»