Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: phR689 on April 15, 2012, 04:47:02 pm

Title: SDL and cpp project.
Post by: phR689 on April 15, 2012, 04:47:02 pm
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
Title: Re: SDL and cpp project.
Post by: stahta01 on April 15, 2012, 06:08:40 pm
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>"
Code
#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.
Title: Re: SDL and cpp project.
Post by: phR689 on April 15, 2012, 07:03:03 pm
hi Tim,

Thanks a lot for your help.

I'll work with this template from now on.

Philippe