sincerely Singaporean

If you have not done so, read this full tutorial on how to use SGEXTN to build an application.

Full Tutorial Part 2

See here for the previous part of the tutorial.

In the previous part, we set up our CMakeLists.txt

writing main.cpp

Now we can click the run button on the bottom left of Qt Creator which looks like a green triangle.

:-1: error: ld.lld: error: undefined symbol: WinMain

oh... We forgot to write the main function... That was blur...

The main function in SGEXTN apps must use the SGEXTN entry point. If you have not done so already, first read this tutorial here.

For now, we just want to confirm that the CMake works, so we will not specify SGXCentral::customInitialise.

#include <SGEXTN_EntryPoint.h> #include <SGXCentral.h> void init(){ SGXCentral::applicationName = "Colours++ - a SGEXTN demo app"; SGXCentral::applicationVersion = "v2.0.0"; SGXCentral::organisationName = "05524F.sg (Singapore)"; SGXCentral::folderName = "ColoursPlusPlus"; } int main(int argc, char** argv){ return SGEXTN(argc, argv, &init); }

This code should go to src/main.cpp, since it is in the sources folder, BuildLah ⁽㈳㈴㈳㈮㈱㈨㈠㈫ ㈧㈤㈱㈤⁾ ensures that it is automatically added to the CMake target.

We just set the basic information of our app using SGXCentral static variables in our entry point for now. We can then click the "run" button.

If you see a window appearing, it means we did everything correctly. Excellent.

Fun fact: did you know that the status bar timer in every SGEXTN app displays the amount of time since the independence of Singapore in years?

Having a working SGEXTN powered window is a great achievement, so we should commit it onto Git. We use these commands below.

git add . git commit -m "initialise repository" git push

The add command adds all your changes to the stage, which is the group of changes to be committed. The commit command actually commits the changes, and the -m allows you to write a commit message describing what this commit is about. The push command syncs the remote repository (GitHub) with the copy on your computer.

In future parts of the tutorial, we will not be going through how to commit to Git again, instead the instructions would be something like "commit this to Git".

See here for the next part of the tutorial.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects