I have been encountering this problem when I try to compile in C. When I asked help50 for help, it gave me this message "By "undefined reference," clang means that you've called a function, print, that doesn't seem to be implemented. If that function has,
in fact, been implemented, odds are you've forgotten to tell clang to "link" against the file that implements print. Did you forget to
compile with -lfoo, where foo is the library that defines print?" Because of this, I decided to implement #include <foo.h>
, however after I tried to compile, I received a fatal error message. This is my code
#include <cs50.h>
#include <stdio.h>
void print(char c, int n);
//Code
int main(void)
{
int n;
do
{
n = get_int("Height:");
} while(n < 1 || n > 8);
for(int i = 0; i < n; i++)
{
print(' ', n - 1 - i);
print('#', i + 1);
print(' ', 2);
print('#', i + 1);
printf("
");
}
}
`
question from:https://stackoverflow.com/questions/65928654/error-message-undefined-reference-to-print-function