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

Author Topic: Strange behavior image in loadFromFile  (Read 2119 times)

0 Members and 2 Guests are viewing this topic.

BioForceGun

  • Newbie
  • *
  • Posts: 3
    • View Profile
Strange behavior image in loadFromFile
« on: January 26, 2017, 10:01:04 am »
Hello! Sorry for stupid question, i'm new in SFML

I'm try compile my game in two different platforms: Fedora 25 and Mac OS X (Sierra 10.12.3). I use Qt Creator as IDE, gcc compiller on Fedora, and clang on Mac OS X. My Trouble is that i'm try load my textures as is:
sf::Texture tankTexture;
if (!tankTexture.loadFromFile("tank.png"))
{
        std::cout << "Error: Can\'t load tank texture" << std::endl;
}
 
Image files located near on binary file in project folder (and in folder with source code too), but as result a have success load texture on project in Fedora and not success load on Mac OS X. Please help! What i am doing wrong?

JayhawkZombie

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Strange behavior image in loadFromFile
« Reply #1 on: January 27, 2017, 02:39:52 am »
I don't remember off the top of my head what the default CWD - Current Working Directory - for MacOSX is, but you could check.  Whenever I fail to load a texture, I'll put a print statement to double-check the directory I'm in to make sure I'm in the right now.  If your CWD is not the directory the texture is in, that would be your problem.

BioForceGun

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Strange behavior image in loadFromFile
« Reply #2 on: January 27, 2017, 08:21:54 am »
Thank you for you answer! This is right. Conserning Qt Creator a decision is - in .pro file remove word "console" from the string "CONFIG += console c++11" and next step we will uncheck "Run in terminal" on the Projects tab (select Run in your build-set in the left side on the screen).