SFML community forums

Help => General => Topic started by: harieamjari on March 09, 2022, 07:28:46 am

Title: Compiling CSFML example in tcc
Post by: harieamjari on March 09, 2022, 07:28:46 am
So currently I would like to test out if could compile an example csfml code with tcc (Tiny C Compiler 0.9.27) on windows, but currently, I have a compiler error:

C:\Users\User6\Desktop>tcc mainpage.c
In file included from mainpage.c:1:
In file included from c:/program files (x86)/tcc/include/SFML/Audio.h:32:
In file included from c:/program files (x86)/tcc/include/SFML/System.h:33:
In file included from c:/program files (x86)/tcc/include/SFML/System/Clock.h:32:
c:/program files (x86)/tcc/include/SFML/System/Time.h:47: error: declaration for parameter 'sfTime_Zero' but no such parameter
 

I'm compiling with csfml 2.5.1 with an example of csfml from https://gist.github.com/def-/fee8bb041719337c8812.

If there's no solution to this other than using a more newer compiler, please do say so. (I'm using tcc as i'm runnng out of storage).

Cheers,

harieamjari
Title: Re: Compiling CSFML example in tcc
Post by: eXpl0it3r on March 09, 2022, 08:02:02 am
To build CSFML itself you still need a C++ compiler, as it simply exposed the C++ library through an C API, this TCC won't be able to build CSFML on its own
Title: Re: Compiling CSFML example in tcc
Post by: kawe on June 21, 2022, 11:47:14 am
The latest tcc (0.9.27) *does* flawlessly compile this code (it's not (C)SFML itself, it's just a simple valid plain C example,  :) ).
However, if you try to compile it using the tcc Windows binary (you are using Windows, don't you?) you need to add an additional include at the very top of your code #include <winapi/windows.h>:

#include <winapi/windows.h>
#include <SFML/Audio.h>
#include <SFML/Graphics.h>

int main()
...

To satisfy this import you may also have to add the 'include' folder from 'winapi-full-for-0.9.27.zip' to tcc's include folder (or read the 'readme.txt' in the zip file).

'winapi-full-for-0.9.27.zip' is available from: http://download.savannah.gnu.org/releases/tinycc/ (http://download.savannah.gnu.org/releases/tinycc/)