# Trying to compile using C++11

This topic is 2106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey,

I'm working on a small OpenGL project and I would like to use C++11 however when I'm trying to compile I get errors :/ Those errors aren't happening when I'm using C++98.

g++ -std=c++11 -Wall -I/opt/local/include -Iinclude src/main.cpp -o src/main.o
Undefined symbols for architecture x86_64:
"RenderWindow::init(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int)", referenced from:
_main in ccLk05Ex.o
"RenderWindow::show()", referenced from:
_main in ccLk05Ex.o
"RenderWindow::shutdown()", referenced from:
_main in ccLk05Ex.o
"RenderWindow::instance_", referenced from:
RenderWindow::getInstance()       in ccLk05Ex.o
"RenderWindow::RenderWindow()", referenced from:
RenderWindow::getInstance()       in ccLk05Ex.o
collect2: error: ld returned 1 exit status
make: *** [src/main.o] Error 1

The content of my main.cpp:

#include <iostream>

#include "renderwindow.h"

int main() {
RenderWindow *renderWindow = RenderWindow::getInstance();
renderWindow->init("OpenGL Framework", 640, 480);

renderWindow->show();

renderWindow->shutdown();
}

My OS is Mac OS X 10.9 and I'm using GLEW, GLFW and GLM.

Would you have any idea why I got those errors ?

##### Share on other sites

I think you'll need to show us the header and the source for RenderWindow. However, I think your invocation of g++ maybe wrong. It looks like you are trying to compile main but you are asking it to build a binary. Perhaps you meant to use -c instead of -o?

-Josh

##### Share on other sites

I think you'll need to show us the header and the source for RenderWindow. However, I think your invocation of g++ maybe wrong. It looks like you are trying to compile main but you are asking it to build a binary. Perhaps you meant to use -c instead of -o?

-Josh

Thank you so much !!! I removed the -c option accidentally :) It's now compiling !

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 18
• 15
• 10
• 9