User forums > Using Code::Blocks

Problem compiling "for loop" with codeblocks compiler.

<< < (3/3)

deva:

Hi friends,

Non of the your advices working. Is there any way still fix the problem. Actually I am newbie to programming. I am just teaching my self from book "C-FromNoviceToProfessional4thEd(2006)" by Ivor Horton,  Apress. 

I tried to compile the same code in Borland Turboo C++ compiler. Its work fine.


But i really like to use CB because its highlight the syntax in colors. So, code looks clean & good.


Any help greately appreciated.


Thanks & Regards,

Deva

zabzonk:
@Deva The code will definitely compile if you rename the file to a  .cpp extension, but if you are trying to learn C rather than C++ this is not the best solution, as it means things that are mistakes in C but not in C++ will not be caught. My solution of creating a console application project and supplying the -std=c99 option should definitely work - it did when I tried it myself - and is the correct way to go if you want to learn C99. Did you actually try it?

Radek:
The following does not work?


--- Code: ---#include <stdio.h>

int main(void)
{
  int count;

  printf("\n**************");       

  for( count = 1 ; count <= 8 ; ++count ) printf("\n* *");

  printf("\n**************\n");

  return 0;
}


--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version