I'm learning to use the Simple, Fast, Multimedia Library (or SFML), and I was going through the tutorials on their website. The first one (found here) said the following:

Under Windows operating systems, you may have created a "Windows Application" project, especially if don't want the console to show up. In such case, to avoid replacing main by WinMain, you can link with SFML_Main static library and keep a standard and portable main entry point.

I have no idea what this means. When I run the .cpp file that you can download at the bottom of the page, it creates 2 windows: the application window and a console window. My questions are:
1. What is a static library, and how do I link it?
2. Which should I include in my program: main(), WinMain(), SFML_Main or a mix?

Additional information: I'm using the Code::Blocks IDE and I'm running it on Windows 7.

Recommended Answers

All 3 Replies

A static library is the opposite of a DLL (dynamic link library).
They mean you can add their library to your linker step.
That way, it will resolve the main/WinMain problem that may have been created by the project type you used for your application.

The static library will usually be a .LIB file (but can also be a .OBJ).

Thank you, but what about my second question: which functions (main, WinMain, SFML_Main) must/should I include? And if I need to include SFML_Main plus main or WinMain, will the program flow begin at SFML_Main, or at the other function (main/WinMain)?

How will the program be started (command-line, Windows or SFML instance)?
I woud imagine, if you need the SFML Main, that one HAS to be the only main.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.