Author Topic: Hi, Having trouble compiling!! Inexplicable error which shouldn't be.  (Read 1579 times)

Offline ym1975

  • Single posting newcomer
  • *
  • Posts: 4
Hi, guys, and thanks in advance for helping me with this. I'm following a tutorial online about introductory C programming and there's a video on functions. Now I copied exactly what the guy said but, inexplicably, I'm getting an error message! Now the only difference is that he's using code blocks 13.01 and I'm using 16.01. I have no idea what I'm doing wrong!?? The exact code is:
#include <stdio.h>
#include <stdlib.h>

void MyFunctionName();
int main()

{
    MyFunctionName();

}

void MyFunctionName();
{
    printf("sum=%d\n", 10+52);
    prinf("We are inside a function\n");
}

The error message stops next to the third curly bracket and the error message is as follows: error: expected identifier or '(' before '{' token

Now this must be some kind of very solution but what could I possibly be doing wrong??

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2814
Re: Hi, Having trouble compiling!! Inexplicable error which shouldn't be.
« Reply #1 on: October 29, 2016, 02:45:49 pm »
1) This is not a generally programming forum, but a forum for codeblocks... Your problem is only a programming error and has nothing to do with codeblocks. So this will probably get locked by a admin and you will get a reprimand
2) If you post code, please use code tags (the # symbol in the post editor)
3) http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Quote
The error message stops next to the third curly bracket and the error message is as follows: error: expected identifier or '(' before '{' token
look at your code.... what is previous the third curly bracket (this should have a line number.....) ? What is there what shouldn't be there....[/size]

greetings
« Last Edit: October 29, 2016, 02:47:40 pm by BlueHazzard »

Offline ym1975

  • Single posting newcomer
  • *
  • Posts: 4
Re: Hi, Having trouble compiling!! Inexplicable error which shouldn't be.
« Reply #2 on: October 29, 2016, 03:23:46 pm »
I don't understand your statement bluehazard. The 3rd curly bracket that I'm talking about is on line 13 and the whole program has 15 lines. Thanks for the posting tip, btw.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2814
Re: Hi, Having trouble compiling!! Inexplicable error which shouldn't be.
« Reply #3 on: October 29, 2016, 04:02:12 pm »
What is there what shouldn't be there

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6981
    • My Best Post
Re: Hi, Having trouble compiling!! Inexplicable error which shouldn't be.
« Reply #4 on: October 29, 2016, 04:05:14 pm »
Please read and follow the rules http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org