¿Cómo modificar la ruta de un archivo .h al usar #include?

when we use #include < stdio.h > in linux platform, the compiler will search the stdio.h in /usr/include. How to change the path of using #include<>? thank you.

I asked the question because of this : when I use the C standard function isdigit(), if "#include< ctype.h >" is not added, the program generates a warning but no error. But if "#include < ctype.h >" is added,it will generate an error when linking.(My compiler is not the standard gcc.)

¿Me pregunto porque?

preguntado el 08 de noviembre de 11 a las 12:11

For standard Libc headers I would avoid doing that. You need the <stdio.h> paired with your libc.so. You can have big trouble if you change it, unless you understand very well what you are doing. -

2 Respuestas

 -I dir
     Add the directory dir to the list of directories to be
     searched for header files.  Directories named by -I are
     searched before the standard system include directories.

respondido 08 nov., 11:16

There are 2 different ways:

  1. Utilizan -Idir in the Makefile or as an argument to gcc.

  2. Crear variable de entorno C_INCLUDE_PATH (para archivos de encabezado C) o CPLUS_INCLUDE_PATH (para archivos de encabezado de C ++).

respondido 08 nov., 11:16

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.