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

Author Topic: THOR[Mac] Compile & Test Examples  (Read 3181 times)

0 Members and 1 Guest are viewing this topic.

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
THOR[Mac] Compile & Test Examples
« on: October 27, 2015, 08:55:43 pm »
Hi, I'm trying to run some of the example code that comes with Thor 2.0 on Mac OS 10.10.5. I've gone through the Cmake install tutorial, and I'm pretty sure I have it installed correctly.

Problem is when I go to compile a sample program I run into problems.
I've tried g++ and clang++ with different flags, all with no success.

For example:
clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window gives a long error message:
  • Undefined symbols for architecture x86_64:
      "sf::String::String(char const*, std::__1::locale const&)", referenced from:
          _main in Action-8f94e3.o
      "thor::Connection::Connection(std::__1::weak_ptr<thor::detail::AbstractConnectionImpl>)", referenced from:
          thor::detail::Listener<thor::ActionContext<MyAction> const&>::shareConnection() const in Action-8f94e3.o
      "thor::Action::Action(sf::Event::EventType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(sf::Mouse::Button, thor::Action::ActionType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(sf::Keyboard::Key, thor::Action::ActionType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(thor::JoystickAxis)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action(thor::JoystickButton, thor::Action::ActionType)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::Action()", referenced from:
          std::__1::map<MyAction, thor::Action, std::__1::less<MyAction>, std::__1::allocator<std::__1::pair<MyAction const, thor::Action> > >::__construct_node_with_key(MyAction const&) in Action-8f94e3.o
      "thor::detail::EventBuffer::pollEvents(sf::Window&)", referenced from:
          thor::ActionMap<MyAction>::update(sf::Window&) in Action-8f94e3.o
      "thor::detail::EventBuffer::clearEvents()", referenced from:
          thor::ActionMap<MyAction>::update(sf::Window&) in Action-8f94e3.o
      "thor::detail::EventBuffer::EventBuffer()", referenced from:
          thor::ActionMap<MyAction>::ActionMap() in Action-8f94e3.o
      "thor::detail::ActionResult::ActionResult()", referenced from:
          thor::ActionMap<MyAction>::invokeCallbacks(thor::EventSystem<thor::ActionContext<MyAction>, MyAction>&, sf::Window*) const in Action-8f94e3.o
      "thor::detail::JoystickBuilder::Axis::above(float)", referenced from:
          _main in Action-8f94e3.o
      "thor::detail::JoystickBuilder::Axis::below(float)", referenced from:
          _main in Action-8f94e3.o
      "thor::detail::JoystickBuilder::axis(sf::Joystick::Axis)", referenced from:
          _main in Action-8f94e3.o
      "thor::detail::JoystickBuilder::button(unsigned int)", referenced from:
          _main in Action-8f94e3.o
      "thor::joystick(unsigned int)", referenced from:
          _main in Action-8f94e3.o
      "thor::operator&&(thor::Action const&, thor::Action const&)", referenced from:
          _main in Action-8f94e3.o
      "thor::operator||(thor::Action const&, thor::Action const&)", referenced from:
          _main in Action-8f94e3.o
      "thor::Action::isActive(thor::detail::EventBuffer const&) const", referenced from:
          thor::ActionMap<MyAction>::isActive(MyAction const&) const in Action-8f94e3.o
      "thor::Action::isActive(thor::detail::EventBuffer const&, thor::detail::ActionResult&) const", referenced from:
          thor::ActionMap<MyAction>::invokeCallbacks(thor::EventSystem<thor::ActionContext<MyAction>, MyAction>&, sf::Window*) const in Action-8f94e3.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


I've tried other flags with clang++ and g++, but all combinations I have tried have resulted in some some aspect of C++ Language not beeing found or recognized(e.g. type_traits not found)


Is clang++ -std=c++11 -stdlib=libc++ the proper compile method for mac?
How do I fix this?


Thanks



Oh, and my version of clang:
clang++ -v
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
« Last Edit: October 28, 2015, 08:10:55 pm by kipbits »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6170
  • Thor Developer
    • View Profile
    • Bromeon
Re: THOR[Mac] what compiler setting do I use?
« Reply #1 on: October 27, 2015, 09:24:58 pm »
These are linker errors, the linker doesn't find the definitions of the mentioned functions.

Quote
clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window
You are only linking to sfml-window. You need thor and sfml-system, too.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] what compiler setting do I use?
« Reply #2 on: October 27, 2015, 10:30:20 pm »
clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window -lsfml-system -thor

clang: error: unknown argument: '-thor'

I ran Cmake for unix
make
sudo make install

files are in:
/usr/local/lib/libthor.dylib
/usr/local/include/Aurora
/usr/local/include/Thor

what is wrong?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6170
  • Thor Developer
    • View Profile
    • Bromeon
Re: THOR[Mac] what compiler setting do I use?
« Reply #3 on: October 27, 2015, 10:59:00 pm »
Please double-check your command (and the error message!) before just posting here blindly. I'm sure you'll find the mistake within seconds ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] what compiler setting do I use?
« Reply #4 on: October 27, 2015, 11:44:10 pm »
i copy pasted what is in the thread

mycomputer:examples me$ clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window -lsfml-system -thor
clang: error: unknown argument: '-thor'
mycomputer:examples me$ clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window -lsfml-system thor
clang: error: no such file or directory: 'thor'
mycomputer:examples me$ clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window -lsfml-system Thor
clang: error: no such file or directory: 'Thor'
mycomputer:examples me$ clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window -lsfml-system -Thor
ld: unknown option: -T
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mycomputer:examples me$

I dont understand what is wrong???

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6170
  • Thor Developer
    • View Profile
    • Bromeon
Re: THOR[Mac] what compiler setting do I use?
« Reply #5 on: October 27, 2015, 11:52:35 pm »
Don't copy-paste, think ;)

The linker flags -lsfml-window -lsfml-system start with -l (the argument to specify a library to the linker), but -thor does not.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] what compiler setting do I use?
« Reply #6 on: October 27, 2015, 11:56:33 pm »
got it  clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window -lsfml-system /usr/local/lib/libthor.dylib


Thanks again

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6170
  • Thor Developer
    • View Profile
    • Bromeon
Re: THOR[Mac] what compiler setting do I use?
« Reply #7 on: October 28, 2015, 12:11:29 am »
Is that a valid linker call? Does -lthor not work? If you install Thor (make install), it should be possible to link it the same way as SFML...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] what compiler setting do I use?
« Reply #8 on: October 28, 2015, 03:48:56 am »
Oh hey, clang++ -std=c++11 -stdlib=libc++ Action.cpp -lsfml-window -lsfml-system -lthor works too. LOL

I'll let you know if i have any other difficulties

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] Compile & Test Examples
« Reply #9 on: October 28, 2015, 08:12:56 pm »
I'm afraid there appears to be something wrong with 4 of the examples: Fireworks.cpp, Shapes.cpp, Triangulation.cpp and Vectors.cpp. They will not run. I'm assuming these are important aspects of Thor that I will need later. They compiled with only minor warnings, but when i went to run I got the following:
  • Fireworks.cpp black window nothing happens.
    Shapes.cpp black window nothing happens.
    Triangulation.cpp black window quits unexpectedly on left click
    Vectors.cpp black window nothing happens

to make things quick, my compiler commands:
clang++ -std=c++11 -stdlib=libc++ Fireworks.cpp -lsfml-window -lsfml-graphics -lsfml-system -lthor
clang++ -std=c++11 -stdlib=libc++ Shapes.cpp -lsfml-window -lsfml-graphics -lsfml-system -lthor
clang++ -std=c++11 -stdlib=libc++ Triangulation.cpp -lsfml-window -lsfml-graphics -lsfml-system -lthor
clang++ -std=c++11 -stdlib=libc++ Vectors.cpp -lsfml-window -lsfml-graphics -lsfml-system -lthor

what is wrong?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6170
  • Thor Developer
    • View Profile
    • Bromeon
Re: THOR[Mac] Compile & Test Examples
« Reply #10 on: October 28, 2015, 08:35:55 pm »
I don't know. You have to provide more information.

For example, run the executables in debug mode and check where/why they exit. And check the console for error outputs.

The other examples work?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] Compile & Test Examples
« Reply #11 on: October 28, 2015, 09:24:28 pm »
the others seem to be fine, I'll get back to you about the debug

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] Compile & Test Examples
« Reply #12 on: October 28, 2015, 10:53:49 pm »
It's been awhile since i've used gdb, or lldb for that matter. you'll have to give me some time. thought I should let you know though

kipbits

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • https://en.sfml-dev.org/forums/index.php?action=profile;u=15614
Re: THOR[Mac] Compile & Test Examples
« Reply #13 on: October 29, 2015, 02:13:36 am »
OK, here's one,
seg fault in Triangulation.cpp at line: thor::triangulate(vertices.begin(), vertices.end(), std::back_inserter(triangles));

Hope that helps? Don't know about the others. My GDB skills are lacking. I might already have the functionality I need...


looking forward to the next update

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6170
  • Thor Developer
    • View Profile
    • Bromeon
Re: THOR[Mac] Compile & Test Examples
« Reply #14 on: October 29, 2015, 06:26:20 am »
seg fault in Triangulation.cpp at line: thor::triangulate(vertices.begin(), vertices.end(), std::back_inserter(triangles));

Hope that helps?
Not really, especially since it works on the other platforms. Can you track more precisly where in that call the segmentation fault occurs? A callstack would be ideal...

By the way, you can edit your posts ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

 

anything