[Solved] Cannot execute file that include files

Iam trying to execute a file that include many files but it seems my main copy.c can't read anyone of them
-----------------------------------------------------------------------------------------
Copy.c

#include <sys/stat.h>
#include <fcntl.h>
#include "tlpi_hdr.h"

#ifndef BUF_SIZE /* Allow "cc -D" to override definition */
#define BUF_SIZE 1024
#endif

int main(int argc, char *argv[])
{
int inputFd, outputFd, openFlags;
mode_t filePerms;
ssize_t numRead;
char buf[BUF_SIZE];

if (argc != 3 || strcmp(argv[1], "--help") == 0)
usageErr("%s old-file new-file\n", argv[0]);

------------------------------------------------------------------------------------------------------------------------
tlpi_hdr.h

#include <sys/types.h>  /* Type definitions used by many programs */
#include <stdio.h>      /* Standard I/O functions */
#include <stdlib.h>     /* Prototypes of commonly used library functions,
                           plus EXIT_SUCCESS and EXIT_FAILURE constants */
#include <unistd.h>     /* Prototypes for many system calls */
#include <errno.h>      /* Declares errno and defines error constants */
#include <string.h>     /* Commonly used string-handling functions */

#include "get_num.h"    /* Declares our functions for handling numeric
                           arguments (getInt(), getLong()) */

#include "error_functions.h"  /* Declares our error-handling functions */

-------------------------------------------------------------------------------------------------------------------------

/* error_functions.h

   Header file for error_functions.c.
*/
#ifndef ERROR_FUNCTIONS_H
#define ERROR_FUNCTIONS_H

/* Error diagnostic routines */

void errMsg(const char *format, ...);

#ifdef __GNUC__

    /* This macro stops 'gcc -Wall' complaining that "control reaches
       end of non-void function" if we use the following functions to
       terminate main() or some other non-void function. */

#define NORETURN __attribute__ ((__noreturn__))
#else
#define NORETURN
#endif

void errExit(const char *format, ...) NORETURN ;

void err_exit(const char *format, ...) NORETURN ;

void errExitEN(int errnum, const char *format, ...) NORETURN ;

void fatal(const char *format, ...) NORETURN ;

void usageErr(const char *format, ...) NORETURN ;

void cmdLineErr(const char *format, ...) NORETURN ;

#endif

------------------------------------------------------------------------------------------------------------------------
and I have a lot of files also but the problem that when I compile copy.cit give output file but when i execute the file it give me

so I "cp" all files to "usr/local/include" but also nothing happens as you saw in previous image....
can anyone help me

These errors are nothing to do with #include files - your compiler is finding them just fine.

Your problem is that the compiler can't find where these functions are defined - it's seen a header file that promises to supply these functions, but they have not been delivered. Where are they defined? If it's another .c file, just include that on your command-line (cc -o copy copy.c other.c etc.c). If they're in a library, take the name of the library minus leading "lib" and minus extension and pass it to an -l (lower-case 'L') flag (e.g. for libabc.so, pass "-labc" in addition to other options.

1 Like

thank you that helped me and my problem solved