Here's my code (written in C), I was trying to program this for a long time, and even when I just tried to copy the code directly from the video lecture, it's wrong! Please help me. Here's my code:


int get_positive_int (void);

int main (void)
    int i= get_positive_int();
    printf("%i \n", i);

int get_positive_int_ (void)
    int n;
      n= get_int("positive integer:");
  return n;

Here's my error:

make positiveint
clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow    positiveint.c  -lcrypt -lcs50 -lm -o positiveint
/usr/bin/ld: /tmp/positiveint-0a58eb.o: in function `main':
/home/ubuntu/positiveint.c:8: undefined reference to `get_positive_int'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: positiveint] Error 1

Somebody please help me!


you have a small typo error in the function you have written:

int get_positive_int


int get_positive_int_

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .