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

Author Topic: [SOLVED] Console visibility  (Read 2955 times)

0 Members and 1 Guest are viewing this topic.

Gerald Bates

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
[SOLVED] Console visibility
« on: June 14, 2024, 01:20:05 pm »
Hello everyone.  I have a quick question about the console window being shown in both debug and release.  Am I right in thinking that if I create an application and supply all the windows skeleton code and use WinMain(...), I can leave the debug as subsystem console and release as windows in visual studio? That way I only get a console for debug builds?
« Last Edit: June 15, 2024, 02:14:10 pm by Gerald Bates »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Console visibility
« Reply #1 on: June 14, 2024, 01:31:55 pm »
Yes, that should work.

If you use sfml-main, you even don't have to use WinMain yourself, but you can link it in release and not in debug
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Gerald Bates

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Console visibility
« Reply #2 on: June 14, 2024, 02:22:07 pm »
Thankyou eXpl0it3r, I did not know that.  And it works, no need for winMain().  Now I have a console in debug build but not in release.

Just one annoying issue left in visual studio.  In debug build I get loads of errors like this one:

warning LNK4099: PDB '' was not found with 'sfml-graphics-s-d.lib(BlendMode.obj)

Is this because I am using a different version of VS than what you built the binaries with?  How can I stop these warnings?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Console visibility
« Reply #3 on: June 14, 2024, 02:29:52 pm »
It complains that it can't find match PDB files, which would contain debug symbols for the given library.
We don't ship PDB files with the pre-build binaries.
You can either ignore the warning or build SFML from source and then make sure to also copy over the PDB files.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Gerald Bates

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Console visibility
« Reply #4 on: June 14, 2024, 05:21:04 pm »
I will deal with PDB issue shortly.  I have installed cmake and compiled sfml from source, have static release and debug now.  Setup my project and tried to build but have errors?  It's the usual test program with a green circle in a window.  Errors are:

error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'sf::VideoMode'
error C2665: 'sf::RenderWindow::RenderWindow': no overloaded function could convert all the argument types
error C2660: 'sf::WindowBase::pollEvent': function does not take 1 arguments
error C2039: 'type': is not a member of 'sf::Event'

Any ideas what's going on?

Gerald Bates

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Console visibility
« Reply #5 on: June 14, 2024, 05:52:57 pm »
I have had a thought.  Why don't I revert to using the pre-built binaries and copy over the pdb files from my build.  Would that work?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Console visibility
« Reply #6 on: June 14, 2024, 08:08:44 pm »
You most likely built from master, which is the work-in-progress SFML 3 version.

You'd want to build from either the 2.6.x branch or the specific git tag.

I have had a thought.  Why don't I revert to using the pre-built binaries and copy over the pdb files from my build.  Would that work?
No, that wouldn't work.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Gerald Bates

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Console visibility
« Reply #7 on: June 14, 2024, 09:06:55 pm »
Yes I built from master!  eXpl0it3r You are seriously good and I appreciate your help.  Will keep progressing and use the branch you suggested.  I am a beginner at this.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Console visibility
« Reply #8 on: June 14, 2024, 10:35:32 pm »
All the best on your journey!  :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Gerald Bates

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Console visibility
« Reply #9 on: June 15, 2024, 01:48:06 pm »
Managed to download correct SFML version and run CMAKE to build static debug/release versions.  The typical test example (green circle) works.  I am also able to change whether I want to see the console in either debug or release versions without errors, so debug has a console and release doesn't.  I don't get PDB errors anymore either.

Thanks  eXpl0it3r for all your help, appreciated.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [SOLVED] Console visibility
« Reply #10 on: June 15, 2024, 10:23:25 pm »
That's great to hear!

No problem :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/