Bonjour a vous,

On m'a demandé de compiler un code et de l'executer dans le cadre d'un projet, seulement j'obtiens les lignes d'erreurs ci-dessous :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
AUXFunc.c: In function ‘ReadNetCDF’:
AUXFunc.c:25: error: ‘NC_NOWRITE’ undeclared (first use in this function)
AUXFunc.c:25: error: (Each undeclared identifier is reported only once
AUXFunc.c:25: error: for each function it appears in.)
AUXFunc.c:25: error: ‘NC_NOERR’ undeclared (first use in this function)
AUXFunc.c: In function ‘ReadNetCDF_int’:
AUXFunc.c:52: error: ‘NC_NOWRITE’ undeclared (first use in this function)
AUXFunc.c:52: error: ‘NC_NOERR’ undeclared (first use in this function)
make: *** [AUXFunc.o] Erreur 1
L'endroit du code concerné étant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
#include "AUXFunc.h"
 
float max(float a, float b)
{
	return( a>=b? a : b );
}
 
float min(float a, float b)
{
	return ( a>=b? b : a );
}
 
void CheckMemAllocationError(void *InVar, const char *InVarName)
{
	if (InVar==NULL)
	{
		printf("Error Allocating Memory: %s\n",InVarName);
		exit(-1);
	}
}
 
void ReadNetCDF(float * InVar, char *InVarName, char *filePath)
{
	int ncid,varid;
	if (nc_open(filePath,NC_NOWRITE,&ncid)!=NC_NOERR)
	{
		printf("\n Error: Can not open %s.nc.\n",InVarName);
		exit(-1);
	}
	else
	{
		if ( nc_inq_varid(ncid,InVarName,&varid)!=NC_NOERR )
		{
			printf("\n Error: Can not find %s variable in the file.\n",InVarName);
			exit(-1);
		}
		else
		{
			printf("Reading %s:\n",InVarName);
			if(nc_get_var_float(ncid,varid,InVar)!=NC_NOERR)
			{
				printf("\n Fatal Error: Can not read %s.\n",InVarName);
				exit(-1);
			}			
		}
	}		
}
Pourriez-vous m'eclairer sur ce qui pose problème?
Merci d'avance !