Bonjour,
J'essaye de compiler mon projet avec VS 2005. Malheuresement, VS 2005 n'aime pas mon projet (plutot j'ai fait une connerie).
L'erreur :
error C2011: 'IFont' : 'struct' type redefinition
Si j'ai bien compris qu'il y a 2 definition de mon class (ou struct) IFont, mais je n'arrive pas a comprendre d'ou vient la deuxieme definition et comment la resoudre ,surtout que mon projet etais developper avec VS 2003 est ca compilé tres bien ( NO ERRORS AVEC VS 2003).
Voici le fichier source de l'erreur :
1. header file :
2. cpp file
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
49
50
51 #pragma once #include <afxwin.h> // MFC core and standard components #include <afxtempl.h> class IFont { public: /*IFont(const char*, const char*, const char*); IFont(const char*, const char*, int);*/ IFont(); ~IFont(); float Height(); float Baseline(); float Width(const char* s, int length); void Extents(const char* s,int i, Text_Extent* e); }; template <class T> class MapIPaint { protected: // void Init(const char*); // void DefineEntries(const char*); // void DefineInitial(const char*); // T* CreateEntry(const char*); int initial; // denotes which entry is used on startup CArray<T*> m_ptArray; int m_current; public: T* FindOrAppend(const CString& str); T* FindOrAppend(unsigned char r, unsigned char g, unsigned char b); T* FindOrAppend(bool none, int p, float w, int l, int r, int z=false); INT_PTR Size() const; bool AtEnd(); T* First(); T* Last(); T* Prev(); T* Next(); int GetCurrentIndex(); T* GetCur(); T* Index(int index) const; int Find(const T* obj) const; void setInitial(int i); T* GetInitial(); };
[
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 #include <stdio.h> #include "mapipaint.h" /////////////////////// IFont /////////////////////// // j'ai pas donné l'implementation ,parceque je suis certains que ca ne vient pas d'ici IFont::IFont() {} IFont::~IFont() {} float IFont::Height() { return 0.0; } float IFont::Baseline() { return 0.0; } float IFont::Width(const char* s, int length) { return 0.0; } void IFont::Extents(const char* s , int i , Text_Extent* e) {} // bien sur ici il y a la definition de class template
Comme je l'avais dis , il compile bien avec VS 2003.
quelqu'un aurra une idée ?
Merci en avance
Partager