char 문자열이 palindrom인지 아닌지를 확인하는 함수를 작성했습니다.C palindrom 프로그램 - 메인에 대한 정의되지 않은 참조
# Makefile
all: main
main: main.o pan.o
clang -o main main.o pan.o
main.o: main.c
clang -c main.c
pan.o: pan.c
clang -c pan.c
clean:
rm -f main *.o *~
:
//pan.c
#include <stdbool.h>
#include "funs.h"
#include <stdio.h>
#include <string.h>
bool palindrom(char napis[])
{
int begin, middle, end, length = 0;
while(napis[length] != '\0')
length++;
end = length - 1;
middle = length;
for (begin = 0; begin < middle; begin++)
{
if(napis[begin] != napis[end])
{
return false;
break;
}
end--;
}
if(begin == middle)
return true;
}
가 나는 또한 지금
//funs.h
#include <stdbool.h>
bool palindrom();
funs.h 만들어 내 주요 기능에
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "funs.h"
int main()
{
char text[100];
bool result;
printf("Enter an char: ");
scanf("%s", text);
result = palindrom(text);
if(result)
{
printf("Brawo!\n");
}
else
{
printf("Gówno!\n");
}
return 0;
}
I도 만들어 메이크이 기능을 사용하기 위해 노력하고있어
모든 항목이 정상적으로 작동하며 단일 파일을 만들지 만 개별적으로 컴파일하려고하면 서로 보지 못합니다. Makefile도 나쁘게 작동하는 것처럼 보이지만 나는 실수를 볼 수 없습니다. 내가 고칠 수있게 도와 줄 수 있니?
'부울 회문()는 어떻게,'모든 int''기본적으로 매개 변수의 수를 수신 할 수있는 기능을 정의합니다. 그래서 잘못되었습니다 ... –
'bool palindrom(); 선언문에 놓친 부분이 없으므로'bool palindrom (char *);'이어야합니다. – rafix07
@MateuszTrzeciak : _but 별도로 컴파일하려고하면 컴파일 할 때 발생하는 오류는 무엇입니까? –