News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

SDL and cpp project.

Started by phR689, April 15, 2012, 04:47:02 PM

Previous topic - Next topic

phR689

Hello
When i create a new SDL project, C::B creates a "main.cpp" file.

But, i want to create a C SDL project.
Can you help me?

My C::B release is 10.05 and runs on a GNU/Linux Ubuntu platform

Regards
Thanks

stahta01

#1
Save "main.cpp" as "main.c"
Add "main.c" to project
remove "main.cpp" from project.

Fix the compiler errors in "main.c"; the simplest fix is adding "#include <stdbool.h>"

#ifdef __cplusplus
   #include <cstdlib>
#else
   #include <stdlib.h>
   #include <stdbool.h>
#endif


Save the project as a template. (Note: I have never done this step myself.)
Use the template for future  C SDL Projects.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

phR689

hi Tim,

Thanks a lot for your help.

I'll work with this template from now on.

Philippe