[완료]expected unqualified-id before '{' token 은 함수 중복을 의미하는 에러가 아닌가요?

gold5230의 이미지

얼마 전부터 c를 공부하게 되어서 간단하게 계산기를 만들어 보았는데

expected unqualified-id before '{' token 이란 에러가 뜨네요.

#include <stdio.h>
 
int func_Plus(int plus_a, int plus_b)
{
	int plus_sum = plus_a + plus_b;
 
	return plus_sum;
}
 
int func_Minus(int minus_a, int minus_b);
{
	int minus_sum = minus_a - minus_b;
 
	return minus_sum;
}
 
int func_Product(int product_a, int product_b)
{
	int product_sum = product_a * product_b;
 
	return product_sum;
}
 
int func_Devide(int devide_a, int devide_b)
{
	int devide_sum = devide_a / devide_b;
 
	return devide_sum;
}
 
 
void Main()
{
	int a, b, c;
	printf("1 = 더하기 2 = 빼기 3 = 곱하기 4 = 나누기");
	printf("명령 입력 :");
	scanf("%d\n", &c);
 
	printf("a 입력 :");
	scanf("%d\n", &a);
	printf("b 입력 :");
	scanf("%d\n", &b);
	if(c == 1){
			printf("%d", func_Plus(a, b));
		}
 
	if(c == 2){
			printf("%d", func_Minus(a, b));
		}
 
	if(c == 3){
			printf("%d", func_Product(a, b));
		}
	if(c == 4){
			printf("%d", func_Devide(a, b));
		}
	if(c > 4){
			printf("System error. please restart.");
		}
 
	return;
}

구글링을 해보니까 이 에러는 제가 선언한 함수 이름이 이미 있어서(즉, 함수가 중복된거죠.) 그렇다고 하네요.

근데 이상한것은 func_Minus에서만 저게 뜬다는거죠.

일단. 함수 이름을 이렇게 저렇게 바꿔 봤습니다. 달라지지는 않더군요.

(원래는 함수 이름이 Minus였는데..흠)

그렇다는것은 이 함수가 어떠한 다른 에러를 가지고 있다고 추측할 수 있을것 같습니다.(물론 구글링을 통해 검색한게 잘못된 정보였으면 틀린 추측이죠.)

어떻게 생각하시나요?

ps. 컴파일러는 MinGW입니다.

snowall의 이미지

int func_Minus(int minus_a, int minus_b); 에서 가장 끝에 있는 ;를 지우세요.

피할 수 있을때 즐겨라! http://melotopia.net/b

gold5230의 이미지

예상 밖이네요. 너무 간단한걸..

근데 왜 syntax error라고 하지 않고 저런 식으로 표현할까요?

허허.

snowall의 이미지

{...}는 블럭이고, 그 앞에 있는건 그 블럭이 어디에 속하는지 알려주는 이름인데, ;는 문장의 끝을 나타내죠. 따라서 컴파일러는 이름이 없는 블럭이 나타났으니까 오류를 표시한 겁니다. 무시하고 컴파일은 할 수 있어요. 하지만 그 블럭은 이름이 없으므로 아무도 불러주지 않는 그저 하나의 몸짓에 불과할 뿐이겠죠.

피할 수 있을때 즐겨라! http://melotopia.net/b

planetarium의 이미지

시적이네요!

addnull의 이미지

좋아요 +1

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.