How to compile a source with "extern"

Marcelo Custodio marcelocustodio@gmail.com
Tue Mar 8 15:28:00 GMT 2005


Hi, 

  I've been trying to building files with external resources but I still don't 
accomplish it. I am running SuSE Linux 9.2.

  I'd like to compile the file teste1.c :
extern int x;
extern void f1();

int main(){
        printf("Valor de X no outro arquivo: %d", x);
        printf("Chamando a função f1() do outro arqivo...\n");
        f1();
}

and the file teste2.c:
void f1(){
        printf("Função contida no arquivo teste2.c...\n");
}

// variável global externa
int x = 12;

int main(){
        //do nothing...
}

what should I do?

Thanks in advance!


---------------------------------------
Marcelo Monteiro Custódio
System Analyst and Developer
DBA Engenharia de Sistemas



More information about the Gcc-help mailing list