Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RenderWindow undefined when using XCode templates  (Read 2185 times)

0 Members and 1 Guest are viewing this topic.

zuon

  • Newbie
  • *
  • Posts: 15
    • View Profile
RenderWindow undefined when using XCode templates
« on: June 07, 2013, 01:41:14 am »
I decided it was time to try to get up to date with SFML 2.0. So I went here
http://www.sfml-dev.org/tutorials/2.0/start-osx.php

I paid special attention to the C++11 stuff because it caused trouble in the release candidate. I don't really care whether I use C++11 or not, I just want to do the easiest thing. Sounds like I need to avoid C++11 to avoid compiling, so not using C++11 is easier.

So I went through the next section. The first step was to go to the downloads page
http://www.sfml-dev.org/download/sfml/2.0/
and... I thought I didn't have to compile for C++11 to work? Why is there a C++11 option here? Oh well, I'll go with the one that's on top because it's probably easier. I copy the stuff, getting confused for a second because the SFML folder was hidden in the templates folder.

I move on. Create a new SFML App. Select the things in the picture. The next steps mock me, because my project is not ready. It is telling me

cc1objplus: warning: -Wuninitialized is not supported without -O

and probably more importantly

Undefined symbols for architecture x86_64:
  "sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, sf::ContextSettings const&)", referenced from:
      _main in main.o

The "read before posting" thread mentions searching the forum. I kept getting slow search times and database errors. I think just Googling this domain is a better idea.

The same thread also mentions removing old versions of SFML. I wish I knew what I did when I installed the SFML 2.0 RC. But I can't find the older version of the tutorial to help figure out what I did, and in any case I tried a bunch of different things when then C++11 shit hit the fan. I can only hope that the things I need to do for SFML 2.0 are the only things that could affect it.

I'm using Mac OS X 10.7.5 and XCode 4.5.1.

I realize I'm overdramatacizing my experience. I'm glad you guys made this library in your spare time and let me use it and support it in the forums. I figure if you're willing to do those things, you might have an interest in what it's like to be a user. So empathize with me if you have such an interest -- pretend this isn't your library, and get frustrated with me. And if you don't, forget about the dramatic bits.

zuon

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: RenderWindow undefined when using XCode templates
« Reply #1 on: June 07, 2013, 06:20:48 pm »
Switching to release build configuration got rid of the warning.

I tried replacing
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
with
sf::RenderWindow window;
window.create(sf::VideoMode(800, 600), "SFML window");
and that produces this error:

"sf::Window::create(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, sf::ContextSettings const&)", referenced from:
      _main in main.o

And I tried
sf::Image icon=window.capture();
because that function is also in RenderWindow.cpp. It worked fine -- it even gave me a runtime error when I took out the window.create line. I don't know how this can happen. It's as if the constructor and create in RenderWindow.cpp didn't agree with RenderWindow.hpp when the frameworks got made.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: RenderWindow undefined when using XCode templates
« Reply #2 on: June 09, 2013, 08:17:22 am »
Quote
Sounds like I need to avoid C++11 to avoid compiling, so not using C++11 is easier.
Fortunately, this is not true.  ;) (That's why there is a C++11 version on the download page).


Undefined symbols for architecture x86_64:
  "sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, sf::ContextSettings const&)", referenced from:
      _main in main.o
It is important to note that's a linker error, not a compiler error. The reason you get this one is probably because you have some old header files from the Release Candidate hidden somewhere because this particular overload of the constructor doesn't exist anymore (the second parameter is a sf::String).

Quote
I wish I knew what I did when I installed the SFML 2.0 RC. But I can't find the older version of the tutorial to help figure out what I did
In fact you don't need the old tutorial because the new one uses the same directories to install SFML – the standard ones.  :)

So, basically, look for SFML stuff in /Library/Framework, /usr/local/include, /usr/local/lib and additionally in /usr/include plus /usr/lib if you installed SFML 2.0 RC in those not recommended folders.
SFML / OS X developer

zuon

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: RenderWindow undefined when using XCode templates
« Reply #3 on: June 10, 2013, 02:15:18 am »
Thanks! Found stuff in /usr/local/lib and /usr/local/include. I wasn't expecting stuff in there because I don't remember trying dylibs, but I must've at some point. I also should've spotted the difference in the old and new constructors.

 

anything