Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22270

program.h don't exists in gcc compilation [duplicate]

$
0
0

I have a very simple program in C with a header .h:

listas_enlazadas.c

#include <stdio.h>#include <listas_enlazadas.h>int longitudl(struct lista *l) {    struct lista *p;    int n;    n = 0;    p = l;    while (p != NULL) {++n;        p = p->sig;    }    return n;}int main(){    // Declaración de lista    struct lista *l;    // Inicialización de lista vacía (l=∅)    l = NULL;    longitudl(l);    return 0;}

listas_enlazadas.h

#ifndef LISTAS_ENLAZADAS_H#define LISTAS_ENLAZADAS_H// Definición de nodos que conforman// la estructura de la listastruct nodo {    int id;    struct nodo* pSig;};// Lista simplemente enlazadastruct lista {   struct nodo nodos;  struct lista *sig;};#endif

In my IDE there are no errors marked and I can navigate between the structure without problems.

But when I try to compile with gcc, in the simplest way (gcc listas_enlazadas.c), throws me the error:

listas_enlazadas.c:2:10: error fatal: listas_enlazadas.h: No existe el fichero o el directorio    2 | #include <listas_enlazadas.h>      |          ^~~~~~~~~~~~~~~~~~~~compilación terminada.

Viewing all articles
Browse latest Browse all 22270

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>