I am taking a computer graphics course using opengl, and for the life of me, I've not been able to compile a single opengl program using the teacher's makefile without doing it on the school's server. I'm not an experience C programmer, so make files are a bit new to me. I've been spoiled by Eclipse compiler always making my build.xml file for me.
I am using cygwin since the teacher's make file is for linux/unix. I have also installed opengl on it via searching under the Graphics category on installation. This is my make file:
#!smake
# Project 1: Simple scene
#
MACHINE= $(shell uname -s)
ifeq ($(MACHINE),Darwin)
OPENGL_INC= -FOpenGL
OPENGL_LIB= -framework OpenGL -framework GLUT -framework Cocoa
else
OPENGL_INC= -I/usr/include
OPENGL_LIB= -L/usr/lib64
LLDLIBS = -lglut -lGL -lGLU -lGL -lXmu -lXext -lX11 -lm
endif
CXX=g++
COMPILER_FLAGS= -g
INCLUDE= $(OPENGL_INC)
While g++ doesn't complain about -lglut, -lGL, -lGLU, etc not existing (it was before), I still get this error message:
g++ -g -L/usr/lib64 -lglut -lGL -lGLU -lGL -lXmu -lXext -lX11 -lm MyCoolModel.o 01primitives.o 01primitivesUtil.o trackball.o model.o -o MyCoolModel
MyCoolModel.o: In function `init()':
/home/01primitives/MyCoolModel.c:48: undefined reference to `__imp_glClearColor'
/home/01primitives/MyCoolModel.c:48:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glClearColor'
/home/01primitives/MyCoolModel.c:49: undefined reference to `__imp_glShadeModel'
/home/01primitives/MyCoolModel.c:49:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glShadeModel'
/home/01primitives/MyCoolModel.c:54: undefined reference to `__imp_glGenLists'
/home/01primitives/MyCoolModel.c:54:(.text+0x41): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glGenLists'
/home/01primitives/MyCoolModel.c:58: undefined reference to `__imp_glGenLists'
/home/01primitives/MyCoolModel.c:58:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glGenLists'
MyCoolModel.o: In function `Display()':
/home/01primitives/MyCoolModel.c:71: undefined reference to `__imp_glClear'
/home/01primitives/MyCoolModel.c:71:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glClear'
/home/01primitives/MyCoolModel.c:73: undefined reference to `__imp_glPushMatrix'
/home/01primitives/MyCoolModel.c:73:(.text+0xab): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glPushMatrix'
/home/01primitives/MyCoolModel.c:76: undefined reference to `__imp_glDisable'
/home/01primitives/MyCoolModel.c:76:(.text+0xbe): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glDisable'
/home/01primitives/MyCoolModel.c:77: undefined reference to `__imp_glDisable'
/home/01primitives/MyCoolModel.c:77:(.text+0xcc): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glDisable'
/home/01primitives/MyCoolModel.c:80: undefined reference to `__imp_glColor3f'
/home/01primitives/MyCoolModel.c:80:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glColor3f'
/home/01primitives/MyCoolModel.c:82: undefined reference to `__imp_glBegin'
/home/01primitives/MyCoolModel.c:82:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_glBegin'
/home/01primitives/MyCoolModel.c:83: undefined reference to `__imp_glVertex3f'
/home/01primitives/MyCoolModel.c:83:(.text+0x114): additional relocation overflows omitted from the output
/home/01primitives/MyCoolModel.c:83: undefined reference to `__imp_glVertex3f'
/home/01primitives/MyCoolModel.c:83: undefined reference to `__imp_glVertex3f'
/home/01primitives/MyCoolModel.c:84: undefined reference to `__imp_glEnd'
/home/01primitives/MyCoolModel.c:85: undefined reference to `__imp_glColor3f'
/home/01primitives/MyCoolModel.c:86: undefined reference to `__imp_glBegin'
/home/01primitives/MyCoolModel.c:87: undefined reference to `__imp_glVertex3f'
/home/01primitives/MyCoolModel.c:87: undefined reference to `__imp_glVertex3f'
/home/01primitives/MyCoolModel.c:87: undefined reference to `__imp_glVertex3f'
/home/01primitives/MyCoolModel.c:88: undefined reference to `__imp_glEnd'
/home/01primitives/MyCoolModel.c:98: undefined reference to `__imp_glCallList'
/home/01primitives/MyCoolModel.c:99: undefined reference to `__imp_glPopMatrix'
/home/01primitives/MyCoolModel.c:102: undefined reference to `__imp_glCallList'
/home/01primitives/MyCoolModel.c:107: undefined reference to `glutSwapBuffers'
MyCoolModel.o: In function `Reshape(int, int)':
/home/01primitives/MyCoolModel.c:118: undefined reference to `__imp_glViewport'
/home/01primitives/MyCoolModel.c:119: undefined reference to `__imp_glMatrixMode'
/home/01primitives/MyCoolModel.c:120: undefined reference to `__imp_glLoadIdentity'
/home/01primitives/MyCoolModel.c:121: undefined reference to `gluPerspective'
/home/01primitives/MyCoolModel.c:122: undefined reference to `__imp_glMatrixMode'
/home/01primitives/MyCoolModel.c:123: undefined reference to `__imp_glLoadIdentity'
/home/01primitives/MyCoolModel.c:124: undefined reference to `__imp_glTranslatef'
MyCoolModel.o: In function `Mouse(int, int, int, int)':
/home/01primitives/MyCoolModel.c:133: undefined reference to `glutPostRedisplay'
MyCoolModel.o: In function `Motion(int, int)':
/home/01primitives/MyCoolModel.c:139: undefined reference to `glutPostRedisplay'
MyCoolModel.o: In function `Keyboard(unsigned char, int, int)':
/home/01primitives/MyCoolModel.c:158: undefined reference to `glutPostRedisplay'
MyCoolModel.o: In function `main':
/home/01primitives/MyCoolModel.c:166: undefined reference to `glutInit'
/home/01primitives/MyCoolModel.c:167: undefined reference to `glutInitWindowPosition'
/home/01primitives/MyCoolModel.c:168: undefined reference to `glutInitWindowSize'
/home/01primitives/MyCoolModel.c:169: undefined reference to `glutInitDisplayMode'
/home/01primitives/MyCoolModel.c:170: undefined reference to `glutCreateWindow'
/home/01primitives/MyCoolModel.c:174: undefined reference to `glutDisplayFunc'
/home/01primitives/MyCoolModel.c:175: undefined reference to `glutReshapeFunc'
/home/01primitives/MyCoolModel.c:176: undefined reference to `glutMouseFunc'
/home/01primitives/MyCoolModel.c:177: undefined reference to `glutMotionFunc'
/home/01primitives/MyCoolModel.c:178: undefined reference to `glutKeyboardFunc'
/home/01primitives/MyCoolModel.c:180: undefined reference to `glutMainLoop'
01primitivesUtil.o: In function `uMakeCoordList(unsigned int)':
/home/01primitives/01primitivesUtil.c:35: undefined reference to `__imp_glNewList'
/home/01primitives/01primitivesUtil.c:37: undefined reference to `__imp_glBegin'
/home/01primitives/01primitivesUtil.c:38: undefined reference to `__imp_glColor3f'
/home/01primitives/01primitivesUtil.c:38: undefined reference to `__imp_glVertex3f'
/home/01primitives/01primitivesUtil.c:38: undefined reference to `__imp_glVertex3f'
/home/01primitives/01primitivesUtil.c:39: undefined reference to `__imp_glColor3f'
/home/01primitives/01primitivesUtil.c:39: undefined reference to `__imp_glVertex3f'
/home/01primitives/01primitivesUtil.c:39: undefined reference to `__imp_glVertex3f'
/home/01primitives/01primitivesUtil.c:40: undefined reference to `__imp_glColor3f'
/home/01primitives/01primitivesUtil.c:40: undefined reference to `__imp_glVertex3f'
/home/01primitives/01primitivesUtil.c:40: undefined reference to `__imp_glVertex3f'
/home/01primitives/01primitivesUtil.c:41: undefined reference to `__imp_glEnd'
/home/01primitives/01primitivesUtil.c:42: undefined reference to `__imp_glEndList'
01primitivesUtil.o: In function `uMakeGroundList(unsigned int)':
/home/01primitives/01primitivesUtil.c:51: undefined reference to `__imp_glNewList'
/home/01primitives/01primitivesUtil.c:53: undefined reference to `__imp_glEndList'
trackball.o: In function `_tbStopMotion(int, unsigned int)':
/home/01primitives/trackball.c:83: undefined reference to `glutIdleFunc'
/home/01primitives/trackball.c:87: undefined reference to `glutIdleFunc'
trackball.o: In function `tbInit(unsigned int)':
/home/01primitives/trackball.c:105: undefined reference to `__imp_glPushMatrix'
/home/01primitives/trackball.c:106: undefined reference to `__imp_glLoadIdentity'
/home/01primitives/trackball.c:107: undefined reference to `__imp_glGetFloatv'
/home/01primitives/trackball.c:108: undefined reference to `__imp_glPopMatrix'
trackball.o: In function `tbMatrix()':
/home/01primitives/trackball.c:117: undefined reference to `__imp_glPushMatrix'
/home/01primitives/trackball.c:118: undefined reference to `__imp_glLoadIdentity'
/home/01primitives/trackball.c:119: undefined reference to `__imp_glRotatef'
/home/01primitives/trackball.c:120: undefined reference to `__imp_glMultMatrixf'
/home/01primitives/trackball.c:121: undefined reference to `__imp_glGetFloatv'
/home/01primitives/trackball.c:122: undefined reference to `__imp_glPopMatrix'
/home/01primitives/trackball.c:124: undefined reference to `__imp_glMultMatrixf'
trackball.o: In function `tbMouse(int, int, int, int)':
/home/01primitives/trackball.c:141: undefined reference to `glutGet'
/home/01primitives/trackball.c:143: undefined reference to `glutGet'
trackball.o: In function `tbMotion(int, int, int)':
/home/01primitives/trackball.c:181: undefined reference to `glutGet'
/home/01primitives/trackball.c:187: undefined reference to `glutPostRedisplay'
trackball.o: In function `tbZoom(float)':
/home/01primitives/trackball.c:199: undefined reference to `__imp_glMatrixMode'
/home/01primitives/trackball.c:200: undefined reference to `__imp_glLoadIdentity'
/home/01primitives/trackball.c:202: undefined reference to `__imp_glTranslatef'
trackball.o: In function `translate(float, float)':
/home/01primitives/trackball.c:208: undefined reference to `__imp_glMatrixMode'
/home/01primitives/trackball.c:209: undefined reference to `__imp_glLoadIdentity'
/home/01primitives/trackball.c:214: undefined reference to `__imp_glTranslatef'
model.o: In function `ModelHead()':
/home/01primitives/model.c:18: undefined reference to `__imp_glPushMatrix'
/home/01primitives/model.c:19: undefined reference to `__imp_glTranslatef'
/home/01primitives/model.c:21: undefined reference to `__imp_glPopMatrix'
model.o: In function `ModelTorso()':
/home/01primitives/model.c:26: undefined reference to `__imp_glPushMatrix'
/home/01primitives/model.c:27: undefined reference to `__imp_glTranslatef'
/home/01primitives/model.c:28: undefined reference to `__imp_glPopMatrix'
model.o: In function `ModelUpperBody()':
/home/01primitives/model.c:33: undefined reference to `__imp_glPushMatrix'
/home/01primitives/model.c:34: undefined reference to `__imp_glTranslatef'
/home/01primitives/model.c:35: undefined reference to `__imp_glPopMatrix'
model.o: In function `ModelLegsAndFeet()':
/home/01primitives/model.c:40: undefined reference to `__imp_glPushMatrix'
/home/01primitives/model.c:41: undefined reference to `__imp_glTranslatef'
/home/01primitives/model.c:42: undefined reference to `__imp_glPopMatrix'
model.o: In function `ModelLittleMario()':
/home/01primitives/model.c:69: undefined reference to `__imp_glRasterPos2f'
/home/01primitives/model.c:70: undefined reference to `__imp_glDrawPixels'
collect2: error: ld returned 1 exit status
Makefile:36: recipe for target 'MyCoolModel' failed
make: *** [MyCoolModel] Error 1
I've been hearing that this sort of problem lies with the linker, although I'm not exactly sure what that means. I am assuming that my header files were recognized, my binaries weren't, or were in the wrong directory.
My teacher's Makefile says that the opengl library files are in a directory called /usr/lib64, but checking my cygwin user directory, it does not exist. I can see the /usr/include folder, though. This could the the problem, but I have no idea how to resolve it. I though that installing opengl on cygwin would take care of this.
Assuming that this is the problem, could anyone help me locate these library files?
Related
I've compiled the OpenSSL library using Mingw32 and MSys with Strawberry Perl.
I used this forum post as a guide, even though it's quite old.
How to build OpenSSL with MinGW in Windows?
Everything went fine, I wanted to compile it as a static library and it worked, but whenever I try to compile the library with my project using g++ I get the following errors, which I have no idea what they mean.
libcrypto.a(e_capi.o):e_capi.c:(.text+0xf1): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x191): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x5ed): undefined reference to `_imp__CertGetCertificateContextProperty#16'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xbd3): undefined reference to `_imp__CertGetCertificateContextProperty#16'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xd40): undefined reference to `_imp__CertEnumCertificatesInStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xdd9): undefined reference to `_imp__CertFindCertificateInStore#24'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3012): undefined reference to `_imp__CertOpenStore#20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3051): undefined reference to `_imp__CertEnumCertificatesInStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x316f): undefined reference to `_imp__CertDuplicateCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x31f1): undefined reference to `_imp__CertCloseStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x32a5): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x396c): undefined reference to `_imp__CertOpenStore#20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x39ab): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x39c3): undefined reference to `_imp__CertCloseStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3a1f): undefined reference to `_imp__CertEnumCertificatesInStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4195): undefined reference to `_imp__CertOpenStore#20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4208): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4221): undefined reference to `_imp__CertCloseStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4359): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x440d): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xbe): undefined reference to `_imp__getnameinfo#28'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xf4): undefined reference to `_imp__ntohs#4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0x29a): undefined reference to `gai_strerrorW'
libcrypto.a(b_addr.o):b_addr.c:(.text+0x7c0): undefined reference to `_imp__freeaddrinfo#4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xae8): undefined reference to `_imp__getaddrinfo#16'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xbc9): undefined reference to `gai_strerrorW'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xcb3): undefined reference to `_imp__getaddrinfo#16'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xd91): undefined reference to `gai_strerrorW'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xdf): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xf0): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x2c7): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x2d8): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x3c1): undefined reference to `_imp__ntohs#4'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x41c): undefined reference to `_imp__getsockopt#20'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x43a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x45c): undefined reference to `_imp__gethostbyname#4'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x4ab): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x4c2): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x54c): undefined reference to `_imp__WSACleanup#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x56d): undefined reference to `_imp__ioctlsocket#12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x58a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x757): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x768): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x962): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x9ec): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xa25): undefined reference to `_imp__ioctlsocket#12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xa42): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xab6): undefined reference to `_imp__getsockname#12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xb1a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x27): undefined reference to `_imp__socket#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x49): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x11c): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x157): undefined reference to `_imp__connect#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x195): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x1a6): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x264): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x2ca): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x362): undefined reference to `_imp__bind#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x3ba): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x467): undefined reference to `_imp__getsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x47d): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x531): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x5dd): undefined reference to `_imp__listen#8'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x5eb): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x675): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x686): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x71a): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x72b): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x792): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x826): undefined reference to `_imp__accept#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x867): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x8cb): undefined reference to `_imp__closesocket#4'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x8ec): undefined reference to `_imp__closesocket#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1b2): undefined reference to `_imp__WSASetLastError#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1d9): undefined reference to `_imp__send#16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x20a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x281): undefined reference to `_imp__WSASetLastError#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x2a0): undefined reference to `_imp__send#16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x2da): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x34d): undefined reference to `_imp__WSASetLastError#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x370): undefined reference to `_imp__recv#16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x3c2): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x482): undefined reference to `_imp__WSAGetLastError#0'
collect2.exe: error: ld returned 1 exit status
I'm using VSCode as a development environment, this is the build command for the project, extracted from tasks.json:
g++.exe file1.cpp file2.cpp main.cpp -L*folder with the library* -lcrypto -o test.exe
The linker can't find several functions from Crypt32.lib and Ws2_32.lib. Link these to your exe by adding -lws2_32 -lcrypt32 to g++ command line.
#pragma comment(lib, "ws2_32.lib") is a Microsoft specific feature, g++ does not support this, thus you were not able to link libraries with this pragma. See also this post - #pragma comment(lib, "xxx.lib") equivalent under Linux?.
I just installed GLFW3 on Ubuntu and I'm testing the example code from the documentation (http://www.glfw.org/documentation.html) and I got those errors.
I tried multiples thing like adding -ldl, but nothing seems to work.
Here is the error log (GCC):
g++ -o bin/Debug/Game obj/Debug/main.o -ldl -lglfw3 -lm -lGL -lGLU
//usr/local/lib/libglfw3.a(vulkan.c.o): In function `_glfwInitVulkan':
vulkan.c:(.text+0x42): undefined reference to `dlopen'
vulkan.c:(.text+0xa9): undefined reference to `dlsym'
//usr/local/lib/libglfw3.a(vulkan.c.o): In function `_glfwTerminateVulkan':
vulkan.c:(.text+0x382): undefined reference to `dlclose'
//usr/local/lib/libglfw3.a(vulkan.c.o): In function `glfwGetInstanceProcAddress':
vulkan.c:(.text+0x72f): undefined reference to `dlsym'
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `translateKeyCode':
x11_init.c:(.text+0x6a): undefined reference to `XkbKeycodeToKeysym'
x11_init.c:(.text+0x14a): undefined reference to `XkbKeycodeToKeysym'
x11_init.c:(.text+0x177): undefined reference to `XGetKeyboardMapping'
x11_init.c:(.text+0x191): undefined reference to `XFree'
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `createKeyTables':
x11_init.c:(.text+0xc3e): undefined reference to `XkbGetMap'
x11_init.c:(.text+0xc61): undefined reference to `XkbGetNames'
x11_init.c:(.text+0x137f): undefined reference to `XkbFreeNames'
x11_init.c:(.text+0x1395): undefined reference to `XkbFreeKeyboard'
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `hasUsableInputMethodStyle':
x11_init.c:(.text+0x14b2): undefined reference to `XGetIMValues'
x11_init.c:(.text+0x150c): undefined reference to `XFree'
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `getSupportedAtom':
x11_init.c:(.text+0x155b): undefined reference to `XInternAtom'
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `detectEWMH':
x11_init.c:(.text+0x15ea): undefined reference to `XInternAtom'
x11_init.c:(.text+0x1610): undefined reference to `XInternAtom'
x11_init.c:(.text+0x1678): undefined reference to `XFree'
x11_init.c:(.text+0x16a1): undefined reference to `XFree'
x11_init.c:(.text+0x16ad): undefined reference to `XFree'
x11_init.c:(.text+0x16be): undefined reference to `XFree'
x11_init.c:(.text+0x16ca): undefined reference to `XFree'
//usr/local/lib/libglfw3.a(x11_init.c.o):x11_init.c:(.text+0x190d): more undefined references to `XFree' follow
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x194e): undefined reference to `dlopen'
x11_init.c:(.text+0x1993): undefined reference to `dlsym'
x11_init.c:(.text+0x19c1): undefined reference to `dlsym'
x11_init.c:(.text+0x19ef): undefined reference to `dlsym'
x11_init.c:(.text+0x1a1d): undefined reference to `dlsym'
x11_init.c:(.text+0x1a8b): undefined reference to `dlopen'
x11_init.c:(.text+0x1ad0): undefined reference to `dlsym'
x11_init.c:(.text+0x1afe): undefined reference to `dlsym'
x11_init.c:(.text+0x1b56): undefined reference to `XQueryExtension'
x11_init.c:(.text+0x1bdf): undefined reference to `dlopen'
x11_init.c:(.text+0x1c24): undefined reference to `dlsym'
x11_init.c:(.text+0x1c52): undefined reference to `dlsym'
x11_init.c:(.text+0x1c80): undefined reference to `dlsym'
x11_init.c:(.text+0x1cae): undefined reference to `dlsym'
x11_init.c:(.text+0x1cdc): undefined reference to `dlsym'
//usr/local/lib/libglfw3.a(x11_init.c.o):x11_init.c:(.text+0x1d0a): more undefined references to `dlsym' follow
//usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x214a): undefined reference to `dlopen'
x11_init.c:(.text+0x218f): undefined reference to `dlsym'
x11_init.c:(.text+0x21bd): undefined reference to `dlsym'
x11_init.c:(.text+0x21eb): undefined reference to `dlsym'
x11_init.c:(.text+0x220d): undefined reference to `dlopen'
x11_init.c:(.text+0x2252): undefined reference to `dlsym'
x11_init.c:(.text+0x2280): undefined reference to `dlsym'
x11_init.c:(.text+0x22ae): undefined reference to `dlsym'
x11_init.c:(.text+0x23b4): undefined reference to `XkbQueryExtension'
x11_init.c:(.text+0x23f3): undefined reference to `XkbSetDetectableAutoRepeat'
x11_init.c:(.text+0x2420): undefined reference to `dlopen'
Order of libraries matter. If library A depends on library B, then A must come before B on the command line.
In your case, since the glfw3 library depends on the dl library, you must switch order so that glfw3 comes before dl on the command line.
You also must link with the X11 library.
So the full command line should look something like
g++ -o bin/Debug/Game obj/Debug/main.o -lglfw3 -ldl -lm -lGL -lGLU -lX11
I am trying to compile a very simple OpenGL program that uses GLFW3. Despite linking everything I deem necessary, I'm getting a plethora of undefined references.
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwInitGammaRamp':
x11_gamma.c:(.text+0x49): undefined reference to `XRRGetScreenResources'
x11_gamma.c:(.text+0x6a): undefined reference to `XRRGetCrtcGammaSize'
x11_gamma.c:(.text+0x81): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwPlatformGetGammaRamp':
x11_gamma.c:(.text+0xce): undefined reference to `XRRGetCrtcGammaSize'
x11_gamma.c:(.text+0xf1): undefined reference to `XRRGetCrtcGamma'
x11_gamma.c:(.text+0x198): undefined reference to `XRRFreeGamma'
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwPlatformSetGammaRamp':
x11_gamma.c:(.text+0x24c): undefined reference to `XRRAllocGamma'
x11_gamma.c:(.text+0x303): undefined reference to `XRRSetCrtcGamma'
x11_gamma.c:(.text+0x30f): undefined reference to `XRRFreeGamma'
/usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x1a67): undefined reference to `XRRQueryExtension'
x11_init.c:(.text+0x1a91): undefined reference to `XRRQueryVersion'
x11_init.c:(.text+0x1b25): undefined reference to `XIQueryVersion'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwSetVideoMode':
x11_monitor.c:(.text+0x177): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x19c): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x1be): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0x3d0): undefined reference to `XRRSetCrtcConfig'
x11_monitor.c:(.text+0x3dc): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x3e8): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x3f4): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwRestoreVideoMode':
x11_monitor.c:(.text+0x446): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x46b): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x4e0): undefined reference to `XRRSetCrtcConfig'
x11_monitor.c:(.text+0x4ec): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x4f8): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitors':
x11_monitor.c:(.text+0x55a): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x577): undefined reference to `XRRGetOutputPrimary'
x11_monitor.c:(.text+0x5cf): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x5ea): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x659): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0x676): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x682): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x703): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x70f): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x733): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitorPos':
x11_monitor.c:(.text+0x8a2): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x8c7): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x8ff): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x90b): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetVideoModes':
x11_monitor.c:(.text+0x9ad): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x9cf): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0xb44): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0xb50): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetVideoMode':
x11_monitor.c:(.text+0xc28): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0xc4d): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0xca2): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0xcae): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_window.c.o): In function `createWindow':
x11_window.c:(.text+0x666): undefined reference to `XISelectEvents'
x11_window.c:(.text+0x6a8): undefined reference to `XRRSelectInput'
/usr/local/lib/libglfw3.a(x11_window.c.o): In function `processEvent':
x11_window.c:(.text+0x1711): undefined reference to `XRRUpdateConfiguration'
My linked CMake flags:
-I/usr/local/include -L/usr/local/lib -lglfw3 -lGLU -lGL -lGLEW
Should I be linking anything else?
I figured out the answer myself while writing the question.
I was misled into believing that I was linking everything necessary because of the output of
pkg-config --libs --cflags --print-requires glfw3
which was
-I/usr/local/include -L/usr/local/lib -lglfw3
The --print-requires flag was having no impact at all on the output, which seemed odd. I searched and printed the corresponding .pc file.
sudo find / | grep "glfw3\.pc"
cat /usr/local/lib/pkgconfig/glfw3.pc
There I found this.
Requires.private: x11 xrandr xi xxf86vm gl
Which indicates which libraries are required for static linking. I added their correponding flags to CMake and it worked. My mistake was that I missed the --print-requires-private flag when executing pkg-config.
I hope this helps someone save some time.
I'm trying to build a C++ program for the Renesas RL78/G13 series of MCUs. I was previously using the IAR toolchain without a problem but now I want to use the GNU RL78 toolchain so I can use some Renesas libraries.
My problem is that I now cannot get the program to link, seemingly because of missing symbols. Any advice would be really appreciated.
Here's the console output from the linker:
'Invoking: Linker'
'Building target:'
rl78-elf-ld -o "firmware_2.x" -T"C:\Projects\ms_monitor\firmware_2\HardwareDebug\firmware_2_HardwareDebug_auto.gsi" -T"C:\Projects\ms_monitor\firmware_2\HardwareDebug\LinkerSubCommand.tmp" libfirmware_2.a -M=firmware_2.map -e_PowerON_Reset -L"C:\Projects\ms_monitor\firmware_2\lib" -L"C:\Projects\ms_monitor\firmware_2\HardwareDebug" -L"C:\Renesas\e2studio\GNURL7~1.01-\rl78-elf\rl78-elf\lib" -L"C:\Renesas\e2studio\GNURL7~1.01-\rl78-elf\lib\gcc\rl78-elf\4.8-GNURL78_v13.01" --start-group -lstdc++ -lfirmware_2 -lgcc --end-group
rl78-elf-ld: section .vects loaded at [00000004,0000007f] overlaps section .vec loaded at [00000000,00000005]
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x2): undefined reference to `_stack'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x9): undefined reference to `_datastart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0xc): undefined reference to `_romdatastart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x11): undefined reference to `_romdatacopysize'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x29): undefined reference to `_bssstart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x31): undefined reference to `_bsssize'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x4c): undefined reference to `etext'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x65): undefined reference to `exit'
libfirmware_2.a(gcrt0.o): In function `rl78_run_preinit_array':
(.text+0x69): undefined reference to `_preinit_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_preinit_array':
(.text+0x6c): undefined reference to `_preinit_array_end'
libfirmware_2.a(gcrt0.o): In function `rl78_run_init_array':
(.text+0x74): undefined reference to `_init_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_init_array':
(.text+0x77): undefined reference to `_init_array_end'
libfirmware_2.a(gcrt0.o): In function `rl78_run_fini_array':
(.text+0x7f): undefined reference to `_fini_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_fini_array':
(.text+0x82): undefined reference to `_fini_array_end'
./src/utilities/csv_loader.o: In function `CsvLoader_Create':
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0xe): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0x18): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0x1d): relocation truncated to fit: R_RL78_DIR16S against `.LC1'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x31): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x3b): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x40): relocation truncated to fit: R_RL78_DIR16S against `.LC2'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x56): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x60): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x65): relocation truncated to fit: R_RL78_DIR16S against `.LC3'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:78:(.text+0x79): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:78:(.text+0x83): additional relocation overflows omitted from the output
libfirmware_2.a(mcount.o): In function `_monstartup':
(.text+0x67b): undefined reference to `ffs'
libfirmware_2.a(printf.o): In function `_printf_r':
(.text+0x30): undefined reference to `_vfprintf_r'
libfirmware_2.a(printf.o): In function `printf':
(.text+0x75): undefined reference to `_vfprintf_r'
libfirmware_2.a(snprintf.o): In function `_snprintf_r':
(.text+0x8d): undefined reference to `_svfprintf_r'
libfirmware_2.a(snprintf.o): In function `snprintf':
(.text+0x165): undefined reference to `_svfprintf_r'
libfirmware_2.a(sprintf.o): In function `_sprintf_r':
(.text+0x4f): undefined reference to `_svfprintf_r'
libfirmware_2.a(sprintf.o): In function `sprintf':
(.text+0xbf): undefined reference to `_svfprintf_r'
libfirmware_2.a(vfiprintf.o): In function `_vfiprintf_r':
(.text+0x1bed): undefined reference to `_free_r'
libfirmware_2.a(vfiprintf.o): In function `_vfiprintf_r':
(.text+0x1c83): undefined reference to `_free_r'
libfirmware_2.a(wsetup.o): In function `__swsetup_r':
(.text+0xf8): undefined reference to `_free_r'
libfirmware_2.a(calloc.o): In function `calloc':
(.text+0x16): undefined reference to `_calloc_r'
libfirmware_2.a(fflush.o): In function `__sflush_r':
(.text+0x324): undefined reference to `_free_r'
libfirmware_2.a(findfp.o): In function `__sfmoreglue':
(.text+0xf2): undefined reference to `_malloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x25e): undefined reference to `_malloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x2de): undefined reference to `_realloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x2ff): undefined reference to `_free_r'
libfirmware_2.a(makebuf.o): In function `__smakebuf_r':
(.text+0x1a2): undefined reference to `_malloc_r'
libfirmware_2.a(malloc.o): In function `malloc':
(.text+0x10): undefined reference to `_malloc_r'
libfirmware_2.a(malloc.o): In function `free':
(.text+0x26): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `cleanup_glue':
(.text+0x3c): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0xb1): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0xe6): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0x111): undefined reference to `_free_r'
libfirmware_2.a(reent.o):(.text+0x172): more undefined references to `_free_r' follow
C:\Projects\ms_monitor\firmware_2\HardwareDebug\libfirmware_2.a(realloc.o): In function `realloc':
(.text+0x16): undefined reference to `_realloc_r'
make: *** [firmware_2.x] Error 1
This question was answered after a lot of support from the KPIT GNU team.
I had incorrect linker files for the processor that I was trying to compile for (as in, the linker file was correct but its contents not). Not only that, some missing symbols depended on how the workspace was configured.
If you see this problem yourself, the first step is to contact KPIT GNU, as I would not have known that there was a problem with the files without asking them.
On ubuntu, I have compiled and installed all the ogre libraries. However, when I try to compile a tutorial with this command
g++ -o otest ogre.cpp -I `pkg-config --libs --cflags OGRE OIS` -lOgreMain -lOI
and it outputs
/tmp/cc9ndjXQ.o: In function `TutorialApplication::TutorialApplication()':
ogre.cpp:(.text+0xd): undefined reference to `BaseApplication::BaseApplication()'
/tmp/cc9ndjXQ.o: In function `TutorialApplication::TutorialApplication()':
ogre.cpp:(.text+0x51): undefined reference to `BaseApplication::BaseApplication()'
/tmp/cc9ndjXQ.o: In function `TutorialApplication::~TutorialApplication()':
ogre.cpp:(.text+0xc6): undefined reference to `BaseApplication::~BaseApplication()'
/tmp/cc9ndjXQ.o: In function `TutorialApplication::~TutorialApplication()':
ogre.cpp:(.text+0x13a): undefined reference to `BaseApplication::~BaseApplication()'
/tmp/cc9ndjXQ.o: In function `TutorialApplication::~TutorialApplication()':
ogre.cpp:(.text+0x1ae): undefined reference to `BaseApplication::~BaseApplication()'
/tmp/cc9ndjXQ.o: In function `main':
ogre.cpp:(.text+0x44d): undefined reference to `BaseApplication::go()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xc): undefined reference to `BaseApplication::frameRenderingQueued(Ogre::FrameEvent const&)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x1c): undefined reference to `BaseApplication::go()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x20): undefined reference to `BaseApplication::setup()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x24): undefined reference to `BaseApplication::configure()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x28): undefined reference to `BaseApplication::chooseSceneManager()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x2c): undefined reference to `BaseApplication::createCamera()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x30): undefined reference to `BaseApplication::createFrameListener()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x38): undefined reference to `BaseApplication::destroyScene()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x3c): undefined reference to `BaseApplication::createViewports()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x40): undefined reference to `BaseApplication::setupResources()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x44): undefined reference to `BaseApplication::createResourceListener()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x48): undefined reference to `BaseApplication::loadResources()'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x4c): undefined reference to `BaseApplication::keyPressed(OIS::KeyEvent const&)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x50): undefined reference to `BaseApplication::keyReleased(OIS::KeyEvent const&)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x54): undefined reference to `BaseApplication::mouseMoved(OIS::MouseEvent const&)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x58): undefined reference to `BaseApplication::mousePressed(OIS::MouseEvent const&, OIS::MouseButtonID)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x5c): undefined reference to `BaseApplication::mouseReleased(OIS::MouseEvent const&, OIS::MouseButtonID)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x60): undefined reference to `BaseApplication::windowResized(Ogre::RenderWindow*)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x64): undefined reference to `BaseApplication::windowClosed(Ogre::RenderWindow*)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x7c): undefined reference to `non-virtual thunk to BaseApplication::windowResized(Ogre::RenderWindow*)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x84): undefined reference to `non-virtual thunk to BaseApplication::windowClosed(Ogre::RenderWindow*)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0x9c): undefined reference to `non-virtual thunk to BaseApplication::keyPressed(OIS::KeyEvent const&)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xa0): undefined reference to `non-virtual thunk to BaseApplication::keyReleased(OIS::KeyEvent const&)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xb4): undefined reference to `non-virtual thunk to BaseApplication::mouseMoved(OIS::MouseEvent const&)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xb8): undefined reference to `non-virtual thunk to BaseApplication::mousePressed(OIS::MouseEvent const&, OIS::MouseButtonID)'
/tmp/cc9ndjXQ.o:(.rodata._ZTV19TutorialApplication[vtable for TutorialApplication]+0xbc): undefined reference to `non-virtual thunk to BaseApplication::mouseReleased(OIS::MouseEvent const&, OIS::MouseButtonID)'
/tmp/cc9ndjXQ.o:(.rodata._ZTI19TutorialApplication[typeinfo for TutorialApplication]+0x8): undefined reference to `typeinfo for BaseApplication'
collect2: ld returned 1 exit status
Anyone know how to fix this/what I am doing wrong?
That's not a compile time error, it's a link time error.
By the looks of things, you probably aren't compiling all the *.cpp files. What file is the body of TutorialApplication's constructor in? You need to compile and link with that.
this works on ogre tutorials :
g++ -o otest *.cpp -I `pkg-config --libs --cflags OGRE OIS`