• Advertisement
Sign in to follow this  

Trying to compile using C++11

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

If you intended to correct an error in the post then please contact us.

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
ld: symbol(s) not found for architecture x86_64
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 ?

 

Thanks in advance !

 

Share this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
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 !

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement