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

Author Topic: Codeblocks portable SFML Problem  (Read 4434 times)

0 Members and 1 Guest are viewing this topic.

DasOhmoff

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Codeblocks portable SFML Problem
« on: June 13, 2013, 08:27:24 pm »
Hi, (I had this post already in the "SFML Projekts" layer or what ever this is called)

I have a SFML Problem, I want to programm with sfml in Codeblocks but it isn't working.

I've downloaded the GCC 4.7 TDM (SJLJ) - 64 bits and I've *past tense of read*  how to install ,

but is still not working. I don't realy like Codeblocks, I have Visual C++

and it is working. I only use Codeblocks on other Computer because its portable, I use it on my

USB Stick.


The Code:

#include <iostream>
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow Window(sf::VideoMode(800,600), "My Game!");
    Window.setFramerateLimit(15);

    while(Window.isOpen())
    {

    }

    Window.clear();
    Window.display();
}


The Error:

-------------- Build: Debug in Mein CB Projekt ---------------

mingw32-g++.exe -L..\..\SFML-2.0\lib  -o "bin\Debug\Mein CB Projekt.exe" obj\Debug\main.o    ..\..\SFML-2.0\lib\libsfml-graphics-d.a ..\..\SFML-2.0\lib\libsfml-window-d.a ..\..\SFML-2.0\lib\libsfml-system-d.a ..\..\SFML-2.0\lib\libsfml-main-d.a ..\..\SFML-2.0\lib\libsfml-audio-d.a ..\..\SFML-2.0\lib\libsfml-network-d.a
obj\Debug\main.o: In function `main':
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:6: undefined reference to `sf::String::String(char const*, std::locale const&)'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:6: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:6: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:6: undefined reference to `sf::RenderWindow::~RenderWindow()'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:7: undefined reference to `sf::Window::setFramerateLimit(unsigned int)'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:9: undefined reference to `sf::Window::isOpen() const'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:14: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:14: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:15: undefined reference to `sf::Window::display()'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:15: undefined reference to `sf::RenderWindow::~RenderWindow()'
J:/CodeBlocks-EP/Meine Projekte/Mein CB Projekt/main.cpp:15: undefined reference to `sf::RenderWindow::~RenderWindow()'
Process terminated with status 1 (0 minutes, 2 seconds)
11 errors, 0 warnings (0 minutes, 2 seconds)
 

Pls help me

PS: SRY for my English im in the 8 Class

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Codeblocks portable SFML Problem
« Reply #1 on: June 13, 2013, 08:45:06 pm »
As said in the original thread: How do your linker settings look?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: Codeblocks portable SFML Problem
« Reply #2 on: June 13, 2013, 11:22:28 pm »
You need to grab one of the nightly builds from here http://sfml.my-gate.net/nightly/ for your version.  The build linked off the official site does not work with the current version of code::blocks.

I had this same problem but snagging a new build fixed it.  You could also recomplile SFML from source to work with your code::blocks if you know how.

Could also be Linker settings.

DasOhmoff

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Codeblocks portable SFML Problem
« Reply #3 on: June 14, 2013, 06:43:52 am »
As said in the original thread: How do your linker settings look?

You mean this?





And I defined "SFML STATIC".

DasOhmoff

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Codeblocks portable SFML Problem
« Reply #4 on: June 14, 2013, 07:20:23 am »
You need to grab one of the nightly builds from here http://sfml.my-gate.net/nightly/ for your version.  The build linked off the official site does not work with the current version of code::blocks.

I had this same problem but snagging a new build fixed it.  You could also recomplile SFML from source to work with your code::blocks if you know how.

Could also be Linker settings.

Ok, I go to this Page and there are 5 Kinds of MinGW but which of them do I choose?

I have a 64-Bit Pc and there's only "MinGW TDM GCC 4.7.1 64bit" or
"MinGW-w64 rubenvb GCC 4.7.2 - 64bit" to choose.

I could experiment but I don't want to mess anything up.
« Last Edit: June 14, 2013, 07:30:41 am by MineTutorials »

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: Codeblocks portable SFML Problem
« Reply #5 on: June 14, 2013, 09:08:08 pm »
snag the 'MinGW TDM GCC 4.7.1 64bit' and redo the tutorial.  Looking at your linker settings you have quite a bit wrong. 

1.  You said you defined SFML_STATIC but you are not linking to the static libraries.  you should be linking to "sfml-graphics-s-d" for STATIC DEBUG and "sfml-graphics-s" for STATIC RELEASE and so forth with the rest.  the Tutorial describes all this if you actually read it and not just look at the pictures.  "sfml-main-d" has no "-s" in it even when statically linking.

2.  your linker setting should look like they do in the tutorial, just "sfml-graphics-s-d", "sfml-window-s-d", "sfml--mainsystem-s-d" and so forth.  you need to get rid of the "..\..\sfml20\lib" and the "  .a" on each entry.

DasOhmoff

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Codeblocks portable SFML Problem
« Reply #6 on: June 19, 2013, 03:15:51 pm »
snag the 'MinGW TDM GCC 4.7.1 64bit' and redo the tutorial.  Looking at your linker settings you have quite a bit wrong. 

1.  You said you defined SFML_STATIC but you are not linking to the static libraries.  you should be linking to "sfml-graphics-s-d" for STATIC DEBUG and "sfml-graphics-s" for STATIC RELEASE and so forth with the rest.  the Tutorial describes all this if you actually read it and not just look at the pictures.  "sfml-main-d" has no "-s" in it even when statically linking.

2.  your linker setting should look like they do in the tutorial, just "sfml-graphics-s-d", "sfml-window-s-d", "sfml--mainsystem-s-d" and so forth.  you need to get rid of the "..\..\sfml20\lib" and the "  .a" on each entry.

I'm so sorry but i can't fix it  :(

I'm to stupid for that  :-[

I made this Video: http://www.youtube.com/watch?v=opnprXlAJwk&feature=youtu.be

(I made it in HD and tried to make it as professional as I can (JUST FOR YOU MEN))

PLS HELP ME MEN, I'M TO STUPID DO THAT...  :-\

PS: If you don't like the music then switch down the speakers

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Codeblocks portable SFML Problem
« Reply #7 on: June 19, 2013, 03:32:19 pm »
You forgot to include SFML :D

By the way, what are SFML_RELEASE and SFML_DEPUG? These macros are not mentioned anywhere. Instead of just experimenting randomly, you should really follow the tutorial carefully.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: Codeblocks portable SFML Problem
« Reply #8 on: June 19, 2013, 09:47:03 pm »
SFML_RELEASE and SFML_DEPUG should be nowhere in your build options.  and it looks like your 'include' and 'lib' directory linkers are pointing in the wrong place.  If i have my sfml2 folder in the Codeblocks folder then my own path looks like "../../codeblocks/sfml2/include" and "../../codeblocks/sfml2/lib"  when set as a relative path.  Maybe when you set your directory do NOT set it as a relative path, that way you can be sure it's looking in the right spot.