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

Author Topic: Compiling CSFML example in tcc  (Read 1801 times)

0 Members and 1 Guest are viewing this topic.

harieamjari

  • Newbie
  • *
  • Posts: 1
    • View Profile
Compiling CSFML example in tcc
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Compiling CSFML example in tcc
« Reply #1 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
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kawe

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Compiling CSFML example in tcc
« Reply #2 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/
 
« Last Edit: June 21, 2022, 11:54:56 am by kawe »

 

anything