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

Author Topic: How to enable a console to see output  (Read 1588 times)

0 Members and 1 Guest are viewing this topic.

Mahorin

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
How to enable a console to see output
« on: September 17, 2023, 02:08:01 am »
hello I have a problem, I am making a game with sfml and I use MinGW for compilation and VScode as ide, so far so good I can compile with my Makefile and it's great, but when I try to display traces with std::cout for example this is not displayed anywhere and I have tried everything but I cannot link from terminal to the program in order to display my traces, could someone help ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How to enable a console to see output
« Reply #1 on: September 18, 2023, 01:24:04 pm »
Don't build with -mwindows and don't link sfml-main, that way you should get a console attached to your application.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mahorin

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: How to enable a console to see output
« Reply #2 on: September 18, 2023, 08:54:40 pm »
Great thank you very much I knew that you shouldn't link sfml-main but I didn't know about mwindows. But to be honest I don't really understand what the mwindows flag represents, and also what sfml-main contains and how it is possible to build without it. Anyway, thanks again  ;D
Also now that I can see the console I notice this error message when i run the program :


AL lib: (EE) SetChannelMap: Failed to match front-center channel (2) in channel map


Could this come from sfml or my code or is it linked to my OS or my drivers?






eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How to enable a console to see output
« Reply #3 on: September 19, 2023, 11:23:31 am »
sfml-main wraps the WinMain function that Windows expects when you want to create an application without console attached and -mwindows changes the subsystem for the same reason.

AL lib: (EE) SetChannelMap: Failed to match front-center channel (2) in channel map
My guess is that you haven't copied the openal32.dll that comes with SFML next to your executable and your executable just picks it up from your system somewhere and it's not fully compatible.
Make sure you use the OpenAL DLL provided by SFML for full compatibility.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mahorin

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: How to enable a console to see output
« Reply #4 on: September 20, 2023, 05:20:10 pm »
thank you for the explanations. On the other hand, as for openal32 I have taken it from sfml so that's not it.