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

Author Topic: Edit: Deleted.  (Read 2983 times)

0 Members and 1 Guest are viewing this topic.

Kobie

  • Guest
Edit: Deleted.
« on: December 19, 2010, 12:30:14 am »
Edit: Deleted.
« Last Edit: December 21, 2012, 12:38:37 am by anonymous191 »

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Cross-platform solution to disabling console output window
« Reply #1 on: December 19, 2010, 02:13:22 am »
Does it really appear if you start it by clicking on the exe trough windows explorer?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

danman

  • Hero Member
  • *****
  • Posts: 1121
    • View Profile
    • Email
Cross-platform solution to disabling console output window
« Reply #2 on: December 19, 2010, 11:04:04 am »
You can use SFML_main ;) .
Pointilleur professionnel

Drektar

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Cross-platform solution to disabling console output window
« Reply #3 on: December 19, 2010, 05:40:10 pm »
Do you compile in debug or release?

To redirect the console output to a file.. You can do something like that:
Code: [Select]
int main()
{


std::ofstream error_file; //File
std::streambuf *cout_buffer = std::cout.rdbuf() ; //Initial buffer of cout
error_file.open("log erreur.txt", std::ofstream::out); //Open file
std::cout.rdbuf( error_file.rdbuf() ); //Change the cout buffer


    //Code here

// Stop using the file
std::cout.rdbuf( cout_buffer );
error_file.close();


    return 0;
}

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Cross-platform solution to disabling console output window
« Reply #4 on: December 19, 2010, 06:54:43 pm »
Doesn't SFML print errors in cerr? You might have to do the same thing but with that object instead.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Cross-platform solution to disabling console output window
« Reply #5 on: December 19, 2010, 08:38:04 pm »
From a very quick search on Google, it seems like you need to add this option to your linker flags:
Quote
-Wl,-subsystem,windows

If it behaves like VC++, your entry point will become WinMain and then you'll have to link to sfml-main to keep main().
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Cross-platform solution to disabling console output window
« Reply #6 on: December 19, 2010, 09:23:15 pm »
Quote
Do you know how I can redirect both cout and cerr output to the same file by chance?

Code: [Select]
std::cout.rdbuf(file.rdbuf());
std::cerr.rdbuf(file.rdbuf());


Quote
Will this retain *nix compatibility? Or is there a way to check OS in the Makefile and use an if/else to switch between Windows and *nix perhaps?

I don't think you can write a single makefile for both Windows/MinGW and Linux/gcc. You should write one makefile for each (or better: use CMake).
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Cross-platform solution to disabling console output window
« Reply #7 on: December 19, 2010, 10:21:38 pm »
Quote
Ah. You know I tried that actually but it didn't work. I was still getting SFML error messages in the console. But it turns out it works just fine, it's just that SFML apparently isn't outputting to std::cerr. If not std::cout, std::cerr, or std::clog (I tried this one too), then where? And how might I redirect wherever that is? :-P

SFML 1 outputs to std::cerr.
SFML 2 outputs to its own stream sf::Err().
Laurent Gomila - SFML developer