Trying to compile using C++11

Started by
1 comment, last by Atemu 10 years, 3 months ago

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 !

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

--www.physicaluncertainty.com
--linkedin
--irc.freenode.net#gdnet

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 !

This topic is closed to new replies.

Advertisement