SFML community forums

Help => General => Topic started by: Mahorin on September 17, 2023, 02:08:01 am

Title: How to enable a console to see output
Post by: Mahorin 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 ?
Title: Re: How to enable a console to see output
Post by: eXpl0it3r 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.
Title: Re: How to enable a console to see output
Post by: Mahorin 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?





Title: Re: How to enable a console to see output
Post by: eXpl0it3r 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.
Title: Re: How to enable a console to see output
Post by: Mahorin 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.