Stephane-D / SGDK

SGDK - A free and open development kit for the Sega Mega Drive
https://www.patreon.com/SGDK
MIT License
1.78k stars 189 forks source link

Error on sprintf visual studio #179

Closed trialforce closed 3 years ago

trialforce commented 3 years ago

Hi!

I'm not a a C developer but I'm get "spected {" on string.h line 159.

Is the sprintf definition.

u16 sprintf(char buffer,const char fmt, ...) attribute ((format (printf, 2, 3)));

If I comment this line I can compile my rom.

How can I solve it?

Stephane-D commented 3 years ago

Hi,

This is to enforce GCC checking parameters provided in a specific way for this function (correct type provided from the input string format) : https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html

This is a GCC stuff and normally if you properly installed SGDK with included GCC binaries it shouldn't complain about it. How did you configured your project in Visual Studio ? i guess the problem is there..

trialforce commented 3 years ago

Hi Stephane!

Thanks for your great work on SGDK and for your anwser.

Sorry, I don't understad very much about C and GCC, I unzip the downloaded SGDK package and put in c:/sgdk. I put some paths on my windows and im Visual studio I created a makefile project with this command line:

%GDK_WIN%\bin\make -f %GDK_WIN%\makefile.gen

I only did that.

Do you have some link that explain the proccess?

Stephane-D commented 3 years ago

Did you added the bin folder of SGDK into your PATH environment variable ? this is important to get SGDK GCC (C compiler) working correctly. To be honest without good knowledge in C, developing with SGDK will be difficult as it implies you already have an experience with C.

trialforce commented 3 years ago

Thanks again Stephane!

I included the BIN and it starts working. The tutorial I watched only said about "inc" folder. I'm a programmer for almost 15 years (python, java, android, c#, php, javascript), I already Know C, but I'm not that good. By tha way, I'm already getting good results with SGDK, thanks.

Stephane-D commented 3 years ago

Unfortunately there is lot of wrong tutorials online :-/ You can just check into SGDK wiki to get proper instructions to start at least. SGDK Wiki definitely contains not much, but you should have basics to start, then you can follow more advanced tutorials :)