Change Compiler Mode Question.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-22 4:11 AM
Posted on March 22, 2016 at 12:11
I'm using System Works IDE, and when I compile my stm32 program I get an error.
error: 'for' loop initial declarations are only allowed in C99 or C11 mode. I know what the complaint is about but how do I set up C11compiler mode, I cant find a switch in the settings dialog box. thanks
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-22 6:19 AM
Posted on March 22, 2016 at 14:19
Try .cpp file, or ''Compile as C++'' like options, I don't use this IDE
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-22 6:53 AM
Posted on March 22, 2016 at 14:53
I guess that you are using c90 as dialect.
this compilation error appears when you are not using C99 and you have written this kind of code :for(int i=0; ....to fix this problem, you have two options:- declare 'i' outside of the loop
- change dialect to C99 : project Properties > C/C++ Build > Settings > Tool Setting [TAB] > MCU GCC Compiler > Dialect > Language standard :: select ISO C99
For me I would prefer to change my code to be dialect compliant.
And if I had to change dialect I will use gnu99 (not c99) since SystemWorkbech uses a GNU compiler (other dialect flags : -std=gnu99)Regards,TarekBOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-22 2:27 PM
Posted on March 22, 2016 at 22:27 thank you tarekb, I changed it to -std=gnu99, it worked. mb
