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

Author Topic: Fail with loading textures. Texture doesn`t like me.  (Read 2611 times)

0 Members and 1 Guest are viewing this topic.

Salmon_Yo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Fail with loading textures. Texture doesn`t like me.
« on: November 10, 2013, 09:52:44 am »
Look, i was trying to do this aboute 2 days.. I asked for VS help, but probably noone know answer, so please help me..

source :
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
int main()
{
        // Create the main window
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
        // Load a sprite to display
        sf::Texture texture;
        if (!texture.loadFromFile("trafaret_fish.jpg"))
                return EXIT_FAILURE;
        sf::Sprite sprite(texture);
       
       
        // Start the game loop
        while (window.isOpen())
        {
                // Process events
                sf::Event event;
                while (window.pollEvent(event))
                {
                        // Close window : exit
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
                // Clear screen
                window.clear();
                // Draw the sprite
                window.draw(sprite);
                // Draw the string
               
                // Update the window
                window.display();
        }
        return EXIT_SUCCESS;
}
 


and problem in the picture. I was trying in VS 2010 Express, and VS 12 - the same problems..
Thank you in advance :)
« Last Edit: November 10, 2013, 10:08:35 am by Salmon_Yo »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #1 on: November 10, 2013, 12:49:46 pm »
You probably link the wrong libraries.

Read the tutorial carefully, and make sure you don't mix configurations (debug/release, static/dynamic, different compiler versions).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Salmon_Yo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #2 on: November 10, 2013, 01:10:39 pm »
I repeat tutorial, how to install SFML for VS, so now i have got correctly working in release Type, and wrong working in debag type but when i reinstalled components i  chose 'All configuration'..
Now for realese i have normal message aboute errore in console. It need the directory for my picture.
But anyway i have also the same problem with debag type as previously. :(

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #3 on: November 10, 2013, 01:14:12 pm »
Tell us the following things:

1. Which version of SFML you downloaded, and how you installed it
2. The compiler version you use
3. Your current project configuration (debug or release)
4. Which libraries you link in this configuration

Be as precise as possible, I prefer not to ask again ;)
« Last Edit: November 10, 2013, 01:17:03 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Salmon_Yo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #4 on: November 10, 2013, 02:47:40 pm »
1. i got SFML 2.1 for Visual Studio 10 (Express) c++ , x32 .
 i chose all cofuguration. Link directory of libs and includes, write full list of lib files in (linker->input->additional dependenciens) how it was in the tutorial. And write SFML_STATIC.
2. Microsoft Visual C++, probably i don`t know really version or name of my compiler.. Sorry=(
3.  In Debag doesn`t works. In release works. I think it must works in both types..
4. full list of files (.lib) in the directory from that website..

1>  "/OUT:C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.exe" "/LIBPATH:D:\SFML-2.1\lib" "sfml-audio.lib" "sfml-audio-d.lib" "sfml-audio-s.lib" "sfml-audio-s-d.lib" "sfml-graphics.lib" "sfml-graphics-d.lib" "sfml-graphics-s.lib" "sfml-graphics-s-d.lib" "sfml-main.lib" "sfml-main-d.lib" "sfml-network.lib" "sfml-network-d.lib" "sfml-network-s.lib" "sfml-network-s-d.lib" "sfml-system.lib" "sfml-system-d.lib" "sfml-system-s.lib" "sfml-system-s-d.lib" "sfml-window.lib" "sfml-window-d.lib" "sfml-window-s.lib" "sfml-window-s-d.lib" /NODEFAULTLIB:msvcrt.lib /MANIFEST "/ManifestFile:Debug\project_SFML.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.lib" /MACHINE:X86 Debug\source.obj
1>sfml-graphics-s.lib(RenderStates.cpp.obj) : error LNK2038: обнаружено несоответствие для "_ITERATOR_DEBUG_LEVEL": значение "0" не соответствует значению "2" в source.obj
1>sfml-graphics-s.lib(Transform.cpp.obj) : error LNK2038: обнаружено несоответствие для "_ITERATOR_DEBUG_LEVEL": значение "0" не соответствует значению "2" в source.obj
1>C:\Users\User\Documents\Visual Studio 2010\Projects\project_SFML\Debug\project_SFML.exe : fatal error LNK1319: обнаружено несоответствий: 2



What does it mean?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #5 on: November 10, 2013, 03:04:44 pm »
Yes, you didn't read the tutorial carefully.

You're not supposed to link multiple variants of one library at the same time. Link only either of sfml-system.lib, sfml-system-d.lib, sfml-system-s.lib or sfml-system-s-d.lib. Not all of them! Which one you have to choose is explained in the tutorial. Read it again.

As you downloaded SFML 2.1 for Visual Studio 2010, I assume this is your compiler, correct? Or which VS version do you have?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Salmon_Yo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #6 on: November 10, 2013, 03:19:23 pm »
yeap, u`re correct.

Salmon_Yo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #7 on: November 10, 2013, 04:11:39 pm »
NEXUS, thank you very much for your help!
Pls, can u help me with a little problem?
How to link directory with picture for my project? :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Fail with loading textures. Texture doesn`t like me.
« Reply #8 on: November 10, 2013, 04:14:49 pm »
How to link directory with picture for my project? :)
What do you mean? Do you want to load an image from a directory? Please open a new thread and describe your problem more clearly...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything