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

Author Topic: The Image Cannot be Found  (Read 2755 times)

0 Members and 5 Guests are viewing this topic.

Mkra

  • Newbie
  • *
  • Posts: 5
    • View Profile
The Image Cannot be Found
« on: February 26, 2012, 10:47:02 am »
Before I state my issue, I'm somewhat experienced in the way of C++. I have used SFML little awhile. I have linked, re-compiled, & built the SFML library for Visual Studio 10. I have linked ALL of the library files. I have copied all the .dll files to my project's workspace. I have set up SFML perfectly.

The problem seems to be that my IDE (VC 2010 Express) cannot locate the file (aFile.png). Here's the code (This program was created for the purpose of creating this error. This is all the program is, the main function.):

Code: [Select]
#include "stdafx.h"

#include <SFML/Graphics.hpp>

using namespace std;
using namespace sf;

int main(int argc, _TCHAR* argv[])
{
Image aImage;

aImage.LoadFromFile("Resources/Graphics/aFile.png");

return 0;
}


There are no compiling or linker errors. I made it a console application & the console prints out text with crazy characters. It says the image cannot load. I've stared at the screen forever. Forever. I've looked in the forums (graphics sections), but to avail. I would appreciate help. Thank you.[/code]
"Young brothers and sisters,
There's a world's worth of work and a need for you."

- Coheed and Cambria

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
The Image Cannot be Found
« Reply #1 on: February 26, 2012, 11:02:39 am »
The only thing that I can think of that might have gone wrong is that you placed the Resources folder in the same folder as your exe instead of placing it in your project folder.

Can you load the image when you pass the full pathname?
TGUI: C++ SFML GUI

Mkra

  • Newbie
  • *
  • Posts: 5
    • View Profile
The Image Cannot be Found
« Reply #2 on: February 26, 2012, 11:13:45 am »
Thanks for the reply. The full path name didn't work. Here's the full path of my .png: "C:\Users\User\Documents\Visual Studio 2010\Projects\App\App\Resources\Graphics\aFile.png"
"Young brothers and sisters,
There's a world's worth of work and a need for you."

- Coheed and Cambria

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
The Image Cannot be Found
« Reply #3 on: February 26, 2012, 11:18:21 am »
Can you show us what gets printed to your console?
Laurent Gomila - SFML developer

Mkra

  • Newbie
  • *
  • Posts: 5
    • View Profile
The Image Cannot be Found
« Reply #4 on: February 26, 2012, 11:29:59 am »
The windows beep sound occurs sometimes (It's the not motherboard). Also, the weird characters are different every time.

What appears in the console window (There are characters I cannot type on my keyboard):

1st Line: Failed to load image "p -5...
2nd Line: sources/Graphics/tiles.png ==...

Also, when I tried this with a RenderWindow, the title of the RenderWindow has weird symbols.
"Young brothers and sisters,
There's a world's worth of work and a need for you."

- Coheed and Cambria

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
The Image Cannot be Found
« Reply #5 on: February 26, 2012, 12:16:14 pm »
Are you linking to release libraries in debug mode?
Laurent Gomila - SFML developer

Mkra

  • Newbie
  • *
  • Posts: 5
    • View Profile
The Image Cannot be Found
« Reply #6 on: February 26, 2012, 12:33:49 pm »
I've linked both release & debug I believe. Example: sfml-graphics;sfml-graphics-d; I'm using SFML 2.0, btw.
"Young brothers and sisters,
There's a world's worth of work and a need for you."

- Coheed and Cambria

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
The Image Cannot be Found
« Reply #7 on: February 26, 2012, 01:50:09 pm »
Quote
I've linked both release & debug

Only link the version that matches your configuration and everything should be fine ;)
Laurent Gomila - SFML developer

Mkra

  • Newbie
  • *
  • Posts: 5
    • View Profile
The Image Cannot be Found
« Reply #8 on: February 26, 2012, 02:02:37 pm »
Thank you so much. It works very well now. I should of known not to link two version of the .libs. I am ashamed to call myself a programmer, but being that I was awake for more than 12 house probably affected my thought process.    :wink:

Thanks again! Love your library, btw.
"Young brothers and sisters,
There's a world's worth of work and a need for you."

- Coheed and Cambria

 

anything