I have a task with this code
#include <stdlib.h>
#include <string.h>
int writeLog(char const *text)
{
 char *auxText = strdup(text);
 if(auxText==NULL)
 return -1;
 char *ptr = auxText + strlen(text);
 do{
 --ptr;
 if(*ptr=='\n' || *ptr=='\r')
 *ptr = 0;
 } while(ptr!=auxText);
 if(strlen(auxText)==0)
 {
 free(auxText);
 return -1;
 }
 FILE *fp = fopen("log.txt","a");
 if(fp==NULL)
 {
 free(auxText);
 return -1;
 }
 fprintf(fp, "%s\n", auxText);
 free(auxText);
 return 0;
}
this is the utils.c file
and the main.c flile:
#include <stdio.h>
#include "utils.h"
int main(int argc, char *argv[]) {
 writeLog("teste");
 return 0;
}
  
but when I do: $ cc main.c utils.c -o myapp
give me this error:

 
     
    