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

Author Topic: [2.0] Project keeps crashing  (Read 4931 times)

0 Members and 1 Guest are viewing this topic.

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
[2.0] Project keeps crashing
« on: August 21, 2012, 08:42:04 pm »
http://pastebin.com/9WZeMnHc

So whenever I compile and run my program, the window shows up, then closes right after. Is there something wrong with my source above?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [2.0] Project keeps crashing
« Reply #1 on: August 21, 2012, 08:54:09 pm »
I guess you already checked the obvious solution, i.e. a failure on texture loading :)

What would help us is to know where it stops. You can easily see that with step by step execution, or by adding output messages at relevant locations in your code.
Laurent Gomila - SFML developer

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: [2.0] Project keeps crashing
« Reply #2 on: August 21, 2012, 08:55:56 pm »
I guess you already checked the obvious solution, i.e. a failure on texture loading :)

What would help us is to know where it stops. You can easily see that with step by step execution, or by adding output messages at relevant locations in your code.

Yea, that seems like the obvious thing to do. In that case, how do I get the console to work along side? Whenever I include <iostream> and use std::cout, nothing happens. Also, I'm using Visual C++ 2010 Express, and I created a Win32 Project.

EDIT: I included <iostream> and when I out put a string in the very beginning of the project, I get this error:

Error   1   error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion)   


Also, this is the line of code causing it:

std::cout << "test";
« Last Edit: August 21, 2012, 08:58:00 pm by rush905 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [2.0] Project keeps crashing
« Reply #3 on: August 21, 2012, 09:05:45 pm »
Quote
In that case, how do I get the console to work along side?
In your project settings, "linker settings" > "system" > "sub-system" -> "Console" instead of "Windows".

Quote
Error   1   error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'overloaded-function' (or there is no acceptable conversion)
If you included <iostream>, std::cout << "test"; should compile. Can you show the real/full code?
Laurent Gomila - SFML developer

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: [2.0] Project keeps crashing
« Reply #4 on: August 21, 2012, 09:24:13 pm »
Alright, <iostream> works now. I just recompiled and it worked. Weird. Anyways, I switched to console, and turns out the problem is that it can't load "figure.jpg". The source is exactly the same as the source in the OP.

EDIT: Forgot to mention, I have the picture spelled correctly, in the same directory, and I can open it, but the error message from the console is as follows:

Failed to load image "figure.jpg". Reason: Unable to open file

Also, the source:

http://pastebin.com/cmhKpwNH
« Last Edit: August 21, 2012, 09:30:05 pm by rush905 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [2.0] Project keeps crashing
« Reply #5 on: August 21, 2012, 10:06:00 pm »
This is a common issue. When launched from the Visual Studio, the working directory is the project directory, not the executable directory. This can be changed in project settings > Debugging > Working Directory > put "$(TargetDir)".
Laurent Gomila - SFML developer

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: [2.0] Project keeps crashing
« Reply #6 on: August 21, 2012, 10:59:24 pm »
Well I decided to move the images into the project directories, and I get this error now from the console:

"Failed to load image "figure.jpg". Reason : JPEG format not supported  (progressive)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: [2.0] Project keeps crashing
« Reply #7 on: August 21, 2012, 11:23:36 pm »
"Failed to load image "figure.jpg". Reason : JPEG format not supported  (progressive)
So you know what to do right? ::)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: [2.0] Project keeps crashing
« Reply #8 on: August 21, 2012, 11:32:57 pm »
"Failed to load image "figure.jpg". Reason : JPEG format not supported  (progressive)
So you know what to do right? ::)

Well I would assume to convert into a .png. But I thought that the .jpg format was supported?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: [2.0] Project keeps crashing
« Reply #9 on: August 21, 2012, 11:41:59 pm »
Well I would assume to convert into a .png. But I thought that the .jpg format was supported?
Well the error says it all...
The progressive JPEG is not supported. ;)
PNG is anyways most of the time the better choice.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

rush905

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: [2.0] Project keeps crashing
« Reply #10 on: August 21, 2012, 11:51:20 pm »
Fair enough. Thanks :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [2.0] Project keeps crashing
« Reply #11 on: August 22, 2012, 08:33:45 am »
Quote
PNG is anyways most of the time the better choice.
I'd say it's 50/50 between png and jpeg. The jpeg format is much better for big pictures that contain a lot of details. png is ok if the image is small, or is RLE-friendly (i.e. contains large spans of the same color).
Laurent Gomila - SFML developer

 

anything