le .h
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 # ifndef _MATRIX # define _MATRIX # include "Matrix.h" template<class U,int n> Matrix<U,n>::Matrix(const int aNbElem[]){ if ( n!=0){ int Nb=0; NbElem = new int[n]; for(int i=0;i<n;i++) { NbElem[i]=aNbElem[i]; Nb*=NbElem[i]; } if (Nb!=0) pMatrix= new U[Nb]; } } #endif
le . cpp
le message d'erreur est
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 # ifndef _MATRIX # define _MATRIX #include <math.h> template< class U,int n=1> class Matrix{ public: Matrix(const int aNbElem[]); public: int *NbElem; U *pMatrix; };
c:\programcpp\stcdo\stcdoproject\cdopricing\headerfiles\matrix.cpp(27) : error C2143: syntax error : missing ';' before '<'
c:\programcpp\stcdo\stcdoproject\cdopricing\headerfiles\matrix.cpp(27) : error C2501: 'Matrix' : missing storage-class or type specifiers
c:\programcpp\stcdo\stcdoproject\cdopricing\headerfiles\matrix.cpp(27) : error C2059: syntax error : ';'
c:\programcpp\stcdo\stcdoproject\cdopricing\headerfiles\matrix.cpp(27) : error C2143: syntax error : missing ';' before '<'
Error executing cl.exe.
Ou fais je une erreur?
Partager