IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Visual C++ Discussion :

3 erreurs de compilation lié au mode managé de VS


Sujet :

Visual C++

  1. #1
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut 3 erreurs de compilation lié au mode managé de VS
    bonjour.

    J'ai entrepris de migrer du code de Java vers VS; J'ai commencé avec le code std, et devant des difficulté d'allocation J'ai entrepris de passer ce code en managé.

    J'avance doucement dans ma migration vers du code managé

    Sur la première méthode j'ai des points durs que je vous soumet.

    cette méthode s'appuie sur des fichiers que je vous détaille ci-dessous:

    d'abord les déclarations de stUnivers et de ElementSemanticM
    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
     
    stUnivers
     
    public ref struct  stUnivers
    {
          int idParagraph;
          System::String^ wsName;
    };
     
    ElementSemanticM
     
    	ref class ElementSemanticM
    	{
    	public:
                 stUnivers Univers;
                 System::String^ wsText;
                 System::String^ wsIdentifier;
                 int siIdOccurence;
                 int nuIdTypeElement;
                 int siNbChunk;
                 int nuIdParagraph;
                 int nuIdChunk;
                 int nuIdElemn;
                 int nuIdChunkType;
                 int siNbWord;
    	     int ullLemmaID;
                 int nuIdDrivingPos;
    	     int nuIdWord;
                 System::String^ wsWord;
    	     System::String^ wsLemma;
    	     System::String^ wsPronunciation;
                 int iValWord;
    	     int cExcluded;
                 int iIdDoc;
                 int iPOS;
    	     int iGender;
    	     int iPers;
    	     int iNbr;
    	     int iLength;
    	     int iWordOccurence;
    	     int indice;
    	     System::String^ Sujet;
    	     System::String^ ListParagraph;
                 List<ElementLinksM^>^ pLink;
    	};
    la deuxième erreur nécessite l'énuméré enChunkType
    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
     
    	public enum class enChunkType
    	{
    		CHUNKTYPE_NONE,                                       // 0 Undefined chunk type
    		CHUNKTYPE_VERB,                                       // 1
    		CHUNKTYPE_NOUN,                                       // 2
    		CHUNKTYPE_FUNCT,                                      // 3
    		CHUNKTYPE_DECLENCHEUR,                                // 4
    		CHUNKTYPE_QUALIFICATEUR,                              // 5
    		CHUNKTYPE_PASSIVE,                                    // 6
    		CHUNKTYPE_OTHER,                                      // 7
    		NUMBER_OF_CHUNKTYPE                                   // 8
    	};
     
    et la suivante référence la structure enPOS
     
    	public enum class enPOS
    	{
    		POS_NONE,								//	Undefined                   0
    		POS_PREP,								//	Preposition                 1
    		POS_ART,								//	Article                     2
    		POS_ADJ,								//	Adjective                   3
    		POS_NOUN,								//	Noun                        4
    		POS_NB,								//	Number                      5
    		POS_MARK,								//	Mark                        6
    		POS_SENT,								//	Sentence point              7
    		POS_STOPMARK,							//	Mark of end of sentence     8
    		POS_COMMA,							//	virgule                     9
    		POS_CONJ,								//	Conjunction                 10
    		POS_PRONOUN,							//	Pronoun                     11
    		POS_VERB,								//	Verb                        12
    		POS_AUX,								//	Auxiliary                   13
    		POS_ADV,								//	Adverb                      14
    		POS_PAST_PARTICIPLE,	                //	Participe passé             15
    		POS_PRESENT_PARTICIPLE,               //  Participe présent           16
    		POS_BLANK,							//	Blank                       17
    		POS_ABREV,                            //  Abreviations                18
    		POS_NAMED_ENTITY,                     //  Noms propre et Entitée nomée19
    		POS_DECLENCHEUR,                      //  mots servant à repèrer les préconditions 20
    		POS_DECLENCHEUR_MOT,                  //  noms déclanchant            21
    		POS_PIVOT,                            //  mot continuant un syntagme  22
    		POS_SEMI_COLUMN,                      //  deux points                 23
    		POS_PASSIVE,                          //  mot introduisnat une forme passive 24
    		POS_COLOR,                            //  couleurs normalisées        25
    		POS_OTHER,							//	Other POS                   26
    		NUMBER_OF_POS,
    	};
    les erreur suivantes nécessitent les types pSegment et pLinguisicSegment
    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
     
    	public ref class CLinguisticSegmentM
    	{
    	public:
    		List<CAnalysedWordM^>  ListWord;                 //  Liste de pointeurs sur les Mots qui constituent le Segment
    		List<CVirtualEquationM^> ListEquation;           //  Liste de pointeurs sur les Equations
    		List<CElementSemantiqueM^> ListProposition;      //  Liste de pointeurs sur les Ngrams qui sont dans le Segment
    		List<CAnalysedChunkM^> ListChunk;                //  Liste de pointeurs sur les Chunks qui sont dans le Segment
    		List<ElementSemanticM^> ListPredicat;
    		List<ElementSemanticM^> ListPrecondition;
    		List<ElementSemanticM^> ListQualificatif;
    		List<ElementSemanticM^> ListUnivers;
    		List<QualificateurNormalizedM^> listQualificateurNormalized;
    		List<PropositionNormalizedM^> ListPredicatNormalized;
    		List<PropositionNormalizedM^> ListPreconditionNormalized;
    		List<CObjetM^> listObjectsNormalized;
     
    		CLinguisticSegmentM()
    		  {;}
    		~CLinguisticSegmentM()
    		  {;}
    	};
     
    	public ref class CAnalysedSegmentM
    	{
    	public:
    	#ifdef CXELDA_MANAGER_H
    		unsigned __int64	        ullSegmentID;             //  Identifiant du Segment dans la base de données
    	#else
    		unsigned long long          ullSegmentID;             //  Identifiant du Segment dans la base de données
    	#endif
    		CLinguisticSegmentM^        pLinguisticSegment;       //  Segment decomposition
    		CLayoutM^					pSegmentLayout;           //  Segment layout at the segment level only
    		short                       shSegmentCharLength;      //  Number of character in sentence
    		short                       shSegmentWordLength;      //  Number of words in sentence
    		enLanguage                  Language;                 //  Langue du segment
    		unsigned long               ulDocPosition;            //  Segment position into the Document
     
    		CAnalysedSegmentM();
    		~CAnalysedSegmentM();
    	};
    la méthode trie les éléments d'une liste en entrée et les répartit dans 4 listes
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
     
    //
    /*----------------------------------------------------------------------------*/
        /*Name          GetElementSemantic                                            */
        /*Role          la méthode trie les éléments d'une liste en entrée            */
        /*              et les répartit dans 4 listes                                 */
        /*Interface                                                                   */
        /*In            pListeElements                                                */
        /*In/Out        None                                                          */
        /*Result        pSegment                                                      */
        /*----------------------------------------------------------------------------*/
        //
        CAnalysedSegmentM^ BuildComponents::GetElementsSemantics( List<ElementSemanticM^>^ plisteElement)
        {
            List<ElementSemanticM^>^ plisteQualificatif;
            List<ElementSemanticM^>^ plistePredicat;
            List<ElementSemanticM^>^ plistePrecondition;
            List<ElementSemanticM^>^ plisteUnivers;
     
            ElementSemanticM^ pEnreg;
            ElementSemanticM^ pNewElemnt;
            ElementSemanticM^ pOldElemnt;
            CAnalysedSegmentM^ pSegment;
     
            int i = 0;
            int j = 0;
            int k = 0;
            int l = 0;
            int m = 0;
            int n = 0;
            int x = 0;
            int y = 0;
            int TempId = 0;
            int OldId = 0;
            int len = 0;
            int nElement = 0;
            int iPos = 0;
            int iVal;
            int iOccur;
            System::String^ wsText = L"";
            System::String^ wsWord = L"";
     
            bool bIsCompleted = false;
            bool bIsQualificateur = false;
            bool bIsPredicat = false;
     
            try
            {
                iSize = 0;
                pOldElemnt = gcnew ElementSemanticM();
                pSegment = gcnew CAnalysedSegmentM();
                pSegment->pLinguisticSegment = gcnew CLinguisticSegmentM();
                for each( pEnreg in plisteElement)
                { // 1
                    wsWord = pEnreg->wsWord;
                    wsText = pEnreg->wsText;
                    iPOS = pEnreg->iPOS;
                    iVal = pEnreg->iValWord;
                    nElement = pEnreg->nuIdElemn;
                    iOccur = pEnreg->siIdOccurence;
    146             wsNextUnivers = pEnreg->Univers.wsName;
                    nParagraph = pEnreg->Univers.idParagraph;
                    iNbPredicat = plistePredicat->Count;
                    iNbQualificateurs = plisteQualificatif->Count;
                    iNbPrecondition = plistePrecondition->Count;
                    pNewElemnt = pEnreg;
                    switch (pEnreg->nuIdTypeElement)
                    {
                        case ELEMENT_PREDICAT:
                            wsText = pNewElemnt->wsText;
                            wsWord = pNewElemnt->wsWord;
                            if( pNewElemnt->nuIdElemn != OldId)
                            {
                                bIsQualificateur = false;
                            }
                            plistePredicat->Add( pNewElemnt);
    162                     if( pEnreg->nuIdChunkType == CHUNKTYPE_QUALIFICATEUR)
                            {
                                if( OldId != pNewElemnt->nuIdElemn)
                                {
                                    bIsQualificateur = true;
    167                             if( pEnreg->iPOS == POS_ART || pEnreg->iPOS == POS_PREP || pEnreg->iPOS == POS_VERB || pEnreg->iPOS == POS_AUX|| pEnreg->iPOS == POS_NB)//il faut rappeler tout ce qui a le même identifiant dans la liste des prédicats
                                    {
                                        for each( pEnreg in plistePredicat)
                                        {
                                            TempId = pNewElemnt->nuIdElemn;
                                            if( pEnreg->nuIdElemn == pNewElemnt->nuIdElemn)
                                            {
                                                wsText = pEnreg->wsText;
                                                wsWord = pEnreg->wsWord;
                                                plisteQualificatif->Add( pEnreg);
                                                bIsCompleted = true;
                                            }
                                            n++;
                                        }
                                    }
                                }
                            }
                            if( bIsQualificateur == true && bIsCompleted == false)
                            {
                                wsText = pEnreg->wsText;
                                wsWord = pEnreg->wsWord;
                                plisteQualificatif->Add( pEnreg);
                            }
                            bIsCompleted = false;
                            iNbQualificateurs = plisteQualificatif->Count;
                            iNbPredicat = plistePredicat->Count;
                            OldId = TempId;
                            break;
                        case ELEMENT_PREDICAT_QUALIFIANT:
                            pNewElemnt = pEnreg;
                            wsText = pNewElemnt->wsText;
                            wsWord = pNewElemnt->wsWord;
                            plistePredicat->Add( pNewElemnt);
                            plisteQualificatif->Add( pNewElemnt);
                            break;
                        case ELEMENT_PRECONDITION:
                            if( bIsPredicat == true)
                                bIsPredicat = false;
                            if( pOldElemnt->wsWord != pEnreg->wsWord)
                            {
                                plistePrecondition->Add( pNewElemnt);
                            }
                            break;
                        case ELEMENT_QUALIFICATEUR:
                            if( bIsPredicat == true)
                            {
                                plistePredicat->Add( pNewElemnt);
                                if(wsWord == L".")
                                {
                                    bIsPredicat = false;
                                }
                            }
                            else if( wsWord == L"then")
                            {
                                bIsPredicat = true;
                                plistePredicat->Add( pNewElemnt);
                            }
                            else
                            {
                                plisteQualificatif->Add( pNewElemnt);
                                iNbQualificateurs = plisteQualificatif->Count;
                            }
                            break;
                        case ELEMENT_TITLE:
                            plisteUnivers->Add( pNewElemnt);
                            break;
                    }
                    pOldElemnt = pEnreg;
                    iSize++;
                } // end while nbElement
            }
            catch (...)
            { // 1
               throw Doc_exception( "Exception NullReference" , iSize);
            } // 1
            try
            {
    244         pSegment->pLinguisticSegment->ListPredicat = plistePredicat;
    245         pSegment->pLinguisticSegment->ListPrecondition = plistePrecondition;
    246         pSegment->pLinguisticSegment->ListQualificatif = plisteQualificatif;
    247         pSegment->pLinguisticSegment->ListUnivers = plisteUnivers;
            }
            catch (...)
            { // 1
               throw Doc_exception( "Exception NullReference" , iSize);
            } // 1
            return ( pSegment);
        }
    cette méthode est assortie d'une liste d'erreurs
    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
    52
    53
    54
    55
    56
    57
     
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(146): error C2679: '=' binaire : aucun opérateur trouvé qui accepte un opérande de partie droite de type 'System::String ^' (ou il n'existe pas de conversion acceptable)
    1>          E:\Program Files\Microsoft Visual Studio 10.0\VC\include\xstring(707): peut être 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(std::basic_string<_Elem,_Traits,_Ax> &&)'
    1>          with
    1>          [
    1>              _Elem=wchar_t,
    1>              _Traits=std::char_traits<wchar_t>,
    1>              _Ax=std::allocator<wchar_t>
    1>          ]
    1>          E:\Program Files\Microsoft Visual Studio 10.0\VC\include\xstring(762): ou       'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(const std::basic_string<_Elem,_Traits,_Ax> &)'
    1>          with
    1>          [
    1>              _Elem=wchar_t,
    1>              _Traits=std::char_traits<wchar_t>,
    1>              _Ax=std::allocator<wchar_t>
    1>          ]
    1>          E:\Program Files\Microsoft Visual Studio 10.0\VC\include\xstring(767): ou       'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(const _Elem *)'
    1>          with
    1>          [
    1>              _Elem=wchar_t,
    1>              _Traits=std::char_traits<wchar_t>,
    1>              _Ax=std::allocator<wchar_t>
    1>          ]
    1>          E:\Program Files\Microsoft Visual Studio 10.0\VC\include\xstring(772): ou       'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator =(_Elem)'
    1>          with
    1>          [
    1>              _Elem=wchar_t,
    1>              _Traits=std::char_traits<wchar_t>,
    1>              _Ax=std::allocator<wchar_t>
    1>          ]
    1>          lors de la tentative de mise en correspondance de la liste des arguments '(std::wstring, System::String ^)'
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(162): error C2065: 'CHUNKTYPE_QUALIFICATEUR' : identificateur non déclaré
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(167): error C2065: 'POS_ART' : identificateur non déclaré
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(167): error C2065: 'POS_PREP' : identificateur non déclaré
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(167): error C2065: 'POS_VERB' : identificateur non déclaré
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(167): error C2065: 'POS_AUX' : identificateur non déclaré
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(167): error C2065: 'POS_NB' : identificateur non déclaré
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(244): error C2582: 'operator =' fonction non disponible dans 'System::Collections::Generic::List<T>'
    1>          with
    1>          [
    1>              T=SpecificationLoader::ElementSemanticM ^
    1>          ]
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(245): error C2582: 'operator =' fonction non disponible dans 'System::Collections::Generic::List<T>'
    1>          with
    1>          [
    1>              T=SpecificationLoader::ElementSemanticM ^
    1>          ]
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(246): error C2582: 'operator =' fonction non disponible dans 'System::Collections::Generic::List<T>'
    1>          with
    1>          [
    1>              T=SpecificationLoader::ElementSemanticM ^
    1>          ]
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(247): error C2582: 'operator =' fonction non disponible dans 'System::Collections::Generic::List<T>'
    1>          with
    1>          [
    1>              T=SpecificationLoader::ElementSemanticM ^
    1>          ]
    Comment traiter ces classes d'erreurs?

    elles sont aux nombre de trois:

    la première touche à l'utilisation du type stUnivers.

    la deuxième touche aux identifiants déclarés dans POSM.

    la troisième concerne l'affectation des listes de sortie à pSegment.

  2. #2
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Pour la première erreur, tu cherches à affecter une System::String^ à une std::string.
    Si tu as une version assez récente de Visual, tu peux utiliser marshal_as< std::string >() pour faire la conversion. Sinon, c'est plus compliqué.

    Pour la seconde classe d'erreur, tu dois utiliser enPOS::POS_ART au lieu de POS_ART, etc.
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  3. #3
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut une partie des réponses
    les solutions sont comme suit
    pour les affectation des liste il a fallu modifier le type CLinguisticSegment pour déclarer les listes sur le thème NomDeLaListe^ HandlerSurLaListe.
    pour le type wsNextUnivers il y avait bien un problème de type wsNextUnivers étant déclaré std::wstring.
    Pour les nommage d'énumérés, la suggestion de Menidoc est pertinente
    il faut les désigner comme NomDeLaClasse::NomDel'Enuméré soit par exemple
    POS_ART s'écrit
    il reste un problème non résolue la référence à objMDBManager

  4. #4
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 074
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 074
    Points : 12 120
    Points
    12 120
    Par défaut
    C'est à dire ???

  5. #5
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut les problèmes résiduel
    Bonjour
    Il me reste quelques erreurs résiduelles:
    D'une part la déclaration des tableaux de données est irrégulière:
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
     
    /*******************************************************************************
    * FILE NAME: TypeDefsM.hpp
    * PURPOSE:   This file contains constants and user defined data for all the
    *            classes.
    * HISTORY:
    * Date        Version                   Author
    * 16/05/2003  initial version :1.0      jn Martin
    *******************************************************************************/
    #ifndef TypeDefsH
    #define TypeDefsH
    #pragma managed
    //--------------------------- INCLUDE-FILES ------------------------------------
    //--------------------------- DECLARATIONS ------------------------------------
    namespace SpecificationLoader
    {
    	using namespace System;
    	using namespace System::Collections::Generic;
     
    	typedef ref struct SplittM	
    	{
    		char* tete;
    		char* queue;
    	}stSPLITT;
     
    	typedef ref struct stElementDescription
    	{
    		System::String^ sSectionName;
    		System::String^ sKeyName;
    		System::String^ sValue;
    		unsigned int dwValue;
    		bool bValue;
    		System::String^ sDefaultValue;
    		unsigned int dwDefaultValue;
    		bool bDefaultValue;
    		int iType;
    	} stOPTIONEXSTRUCTURE;
     
    	typedef ref struct stOptionStructureM
    	{
    		System::String^ sSectionName;
    		System::String^ sKeyName;
    		System::String^ sValue;
    	} stOPTIONSTRUCTURE;
     
    	typedef ref struct stPOS
    	{
    47		enPOS pPOS[enPOS::NUMBER_OF_POS];
    	}ST_POS;
     
    	typedef ref struct stAnalysedWordM
    	{
    52		wchar_t						wsWord[MAX_LINE_SIZE];	  //  Texte du mot
    53		wchar_t						wsLemma[MAX_LINE_SIZE];	  //  Texte du lemma
    		enPOS                       POS;                      //  Part Of Speech du lemma (et du mot)
    		enGender                    Gender;                   //  Genre du lemma (et du mot)
    		enPers                      iPers;
    		enNbr                       iNbr;
    		int                         iExcluded;                //  Le lemma est important ou non
    		unsigned long               ulStart;                  //  Position du premier caractère du mot dans le segment
    		unsigned long               ulLength;                 //  Longueur du mot (les espaces sont exclus)
    	} stANALYSED_WORD;
     
    	typedef ref struct stTranslationLemmaM
    	{
          hidDB idSrcWord;
          hidDB idSrcLemma;
          hidDB idTgtLemma;
          int iProb;
          bool bExclude;
          hidDB hiPos;
          hidDB hiGender;
          hidDB hiLangue;
    	}stTRANSLATION_LEMMA;
     
    	typedef ref struct stListOfElementValuesM
    	{
          hidDB idElement;
          List<stTranslationLemmaM^>^ pListLemma;
    	}stLIST_OF_ELEMENT_VALUES;
     
    	typedef ref struct stElementAlignmentM
    	{
          hidDB idElement;
          hidDB idSegSrc;
          hidDB idSegTgt;
          List<stTranslationLemmaM^>^ pListWord;
          hidDB idChkSrc;
          hidDB idChkTgt;
          hidDB TypeChunk;
          hidDB TypeSeg;
          hidDB Proba;
    	} stELEMENT_ALIGNMENT;
    };
    #endif
    d'une part les initialisation de tableaux posent problème

    d'autre part je n'arrive pas a compiler mes déclaration d'objet de liaison
    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
    52
    53
    54
    55
    56
     
    /*******************************************************************************
     * NOM: 
     * ROLE: 
     * HISTORIQUE:
        * 05/05/2001, xxx, initial version
    *******************************************************************************/
    #ifndef POS_H
    #define POS_H
    /*_____INCLUDE-FILES__________________________________________________________*/
    #pragma managed
    /*_____GLOBAL-DEFINE__________________________________________________________*/
    /*_____GLOBAL-TYPES___________________________________________________________*/
     
    /*_____GLOBAL-DATA____________________________________________________________*/
    /*_____GLOBAL-MACROS__________________________________________________________*/
    /*_____GLOBAL-FUNCTIONS-PROTOTYPES____________________________________________*/
     
    namespace SpecificationLoader
    {
        using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Collections::Generic;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
    	using namespace System::IO;
     
    	ref class CPOSM
    	{
    	public:
    		stPOS  stPos;//	Part Of Speech de l'element
    		enPOS  POS;											
    		CPOSM::CPOSM();
    		CPOSM::~CPOSM();
    		std::wstring CPOSM::GetPOSLabelWithPOS(enPOS POS);
    		enPOS CPOSM::GetPOSWithPOSLabel(std::wstring wsPOS);
    	};
    39	CPOSM objPOS;
     
    	ref class CLemmaDescriptionM
    	{
    	public:
    		long long         llLemmaID;                //  Identifiant du lien
    		System::String^   wsText;                   //  Texte du lemma
    		CPOSM^             pPOS;	                    //  Part Of Speech du Lemma
    		enGender          Gender;		                //  Genre du Lemma
    		enLanguage        Language;	                //  Langage du Lemma
    		bool              bExcluded;                //  Le lemma est important ou non
     
    		CLemmaDescriptionM(){};
    		~CLemmaDescriptionM(){};
    	};
    };
    #endif /* POS_H */
    J'ai mis en marge les numéro de lignes en erreur.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    1>E:\usr\Memoria\dev\Common\com\TypeDefsM.hpp(47): error C2440: 'declarator'*: impossible de convertir de 'SpecificationLoader::enPOS' en 'int'
    1>E:\usr\Memoria\dev\Common\com\TypeDefsM.hpp(47): error C4368: impossible de définir 'pPOS' comme membre de 'SpecificationLoader::stPOS' managé*: les types mixtes ne sont pas pris en charge
    1>E:\usr\Memoria\dev\Common\com\TypeDefsM.hpp(52): error C4368: impossible de définir 'wsWord' comme membre de 'SpecificationLoader::stAnalysedWordM' managé*: les types mixtes ne sont pas pris en charge
    1>E:\usr\Memoria\dev\Common\com\TypeDefsM.hpp(53): error C4368: impossible de définir 'wsLemma' comme membre de 'SpecificationLoader::stAnalysedWordM' managé*: les types mixtes ne sont pas pris en charge
    1>E:\usr\Memoria\dev\Common\com\POSM.h(39): error C3145: 'objPOS'*: une variable globale ou statique ne peut pas avoir de type managé 'SpecificationLoader::CPOSM'

  6. #6
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    1. Il faut caster.
    2. Une ref class n'a pas le droit de contenir un tableau de taille fixe. Mais elle peut contenir un array<enPOS>^ (tableau dynamique managé).
    3. Pareil, tu dois utiliser une System::String^ ou un array<wchar_t>^.
    4. ditto.
    5. Déclare cette variable sous forme de pointeur managé en static dans la classe: public: static CPOSM^ objPOS;.
      N'oublie pas que pour toute déclaration du type ref class Toto {}; Toto x; Toto^ y;, la partie Toto x; est en fait un hack, un sucre syntaxique donné par C++/CLI pour prendre en charge l'allocation et le dispose de l'objet (et ne sert à rien si l'objet n'est pas disposable, c'est-à-dire (en C++/CLI) s'il n'a pas de destructeur/finaliseur managé).
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  7. #7
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut un resultat sur deux
    bonjour et merci pour les conseil; un problème a été résolue.
    mais le deuxième persiste.
    je donne ce que j'ai fait et les messages générés par le compilateur
    J'ai d'abord copié la consigne que vous avez donné. Et comme elle ne passait pas à la compilation, j'ai repris et je suis arrivé à:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    public static CPOSM^ objPOS;
    et le compilateur à donné exactement le même résultat que celui qu'il avait donné à votre rédaction. Je vous le donne:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    1>E:\usr\Memoria\dev\Common\com\POSM.h(39): error C2059: erreur de syntaxe*: 'public'
    1>E:\usr\Memoria\dev\DBMS\MissionDBManager\com\MissionDatabaseManagerM.h(53): error C3145: 'objMDBManager'*: une variable globale ou statique ne peut pas avoir de type managé 'SpecificationLoader::CMDBManagerM'
    1>          impossible de déclarer une variable globale ou statique, ou un membre d'un type natif faisant référence à des objets du tas gc

  8. #8
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    C'est la même erreur, mais plus la même variable.
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  9. #9
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut Ce résiste
    il me reste deux erreurs dans cette classe de 3000 LOC qui est maintenant entièrement codé en managé.
    il faudra bien y arriver un jour.
    je vous donne les trois déclarations et les messages d'erreur qui s'y rattachent:
    Le premier fichier est la classe POSM
    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
    52
    53
    54
    55
    56
     
    /*******************************************************************************
     * NOM: 
     * ROLE: 
     * HISTORIQUE:
        * 05/05/2001, xxx, initial version
    *******************************************************************************/
    #ifndef POS_H
    #define POS_H
    /*_____INCLUDE-FILES__________________________________________________________*/
    #pragma managed
    /*_____GLOBAL-DEFINE__________________________________________________________*/
    /*_____GLOBAL-TYPES___________________________________________________________*/
     
    /*_____GLOBAL-DATA____________________________________________________________*/
    /*_____GLOBAL-MACROS__________________________________________________________*/
    /*_____GLOBAL-FUNCTIONS-PROTOTYPES____________________________________________*/
     
    namespace SpecificationLoader
    {
        using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Collections::Generic;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
    	using namespace System::IO;
     
    	ref class CPOSM
    	{
    	public:
    		stPOS  stPos;//	Part Of Speech de l'element
    		enPOS  POS;											
    		CPOSM::CPOSM();
    		CPOSM::~CPOSM();
    		std::wstring CPOSM::GetPOSLabelWithPOS(enPOS POS);
    		enPOS CPOSM::GetPOSWithPOSLabel(std::wstring wsPOS);
    	};
    39	static CPOSM^ objPOS;
     
    	ref class CLemmaDescriptionM
    	{
    	public:
    		long long         llLemmaID;                //  Identifiant du lien
    		System::String^   wsText;                   //  Texte du lemma
    		CPOSM^             pPOS;	                    //  Part Of Speech du Lemma
    		enGender          Gender;		                //  Genre du Lemma
    		enLanguage        Language;	                //  Langage du Lemma
    		bool              bExcluded;                //  Le lemma est important ou non
     
    		CLemmaDescriptionM(){};
    		~CLemmaDescriptionM(){};
    	};
    };
    #endif /* POS_H */
    le deuxième fichier est la classe MissionDatabseManagerM
    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
    52
    53
    54
    55
    56
    57
    58
    59
     
    //--------------------------------------------------------------------------------------------------------------------------------
    /* Global conception    : 06-12-2003 ; 19:01:55                                                                                   */
    // Specification        : 05-12-2003  14:54:40
    // ALITEC
    // Rue Leonard de vinci
    // 53061 LAVAL CEDEX 09
    // (c) Copyright ALITEC
    //--------------------------------------------------------------------------------------------------------------------------------
    /*******************************************************************************
     * NOM:
     * ROLE:
     * HISTORIQUE:
        * 05/05/2001, xxx, initial version
    *******************************************************************************/
    #ifndef MISSION_DATABASE_MANAGERM_H
    #define MISSION_DATABASE_MANAGERM_H
    /*_____INCLUDE-FILES__________________________________________________________*/
    /*_____GLOBAL-DEFINE__________________________________________________________*/
    //
    //--------------------------------------------------------------------------------------------------------------------------------
    //Class         CMDBManager
    //--------------------------------------------------------------------------------------------------------------------------------
    //  CLASS CMDBManager
    //    (Public)
    //      ENUM ERR_MDBManager                   Class Error code
    //        ERR_UNKNOWN_SERVER_TYPE             Server type not recognized
    //        ERR_SERVER_NOT_CONNECTED            Connection to the Server is not established
    //
    #pragma managed
    namespace SpecificationLoader
    {
        using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
    	using namespace System::IO;
    	using namespace std;
     
    	ref class CMDBManagerM
    	{
    	public:
    		CMDBManagerM::CMDBManagerM();
    		CMDBManagerM::~CMDBManagerM();
    ////////////////////////////////////////////////////////////////////////////////
    //  Divers
    ////////////////////////////////////////////////////////////////////////////////
    		List<ElementLinksM^>^ CMDBManagerM::getLinks( ElementSemanticM^ pEnreg, int indice);
    		List<ElementSemanticM^>^  CMDBManagerM::ReadSemanticElements( int iIdDoc);
    	};
    53	static SpecificationLoader::CMDBManagerM^ objMDBManager;
    };
    //ATAD
    /*_____GLOBAL-DATA____________________________________________________________*/
    /*_____GLOBAL-MACROS__________________________________________________________*/
    /*_____GLOBAL-FUNCTIONS-PROTOTYPES____________________________________________*/
    #endif /* MISSION_DATABASE_MANAGER_H */
    et le troisième fichier est la classe maitresse qui déclare l'objet objMDBManager pour pouvoir l'utiliser
    je vous donne le code jusqu'a la déclaration:
    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
     
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    #pragma managed 
    #include "StdAfx.h"
    #include "ibase.h"
    #include "IBPP.h"
    #include "AlignStructure.h"
    #include "Macro.h"
    #include "EnumerationM.hpp"
    #include "StructureM.h"
    #include "TypeDefsM.hpp"
    #include "POSM.h"
    #include "Layout.h"
    #include "ClasseAlignerManaged.hpp"
    #include "MissionDatabaseManagerM.h"
    #include "StrConv.h"
    #include "StrToken.h"
    #include "Message.h"
    #include "WordManager.h"
    #include "Exception.h"
    #include "BuildComponents.h"
     
    /*_____LOCAL-DEFINE___________________________________________________________*/
    /*_____LOCAL-TYPES____________________________________________________________*/
    /*_____GLOBAL-DATA____________________________________________________________*/
     
    extern int                               iIdDoc;
    extern long                              idSegment;
    extern int                               iPredicate;
    extern int                               nParagraph;
    extern int                               u;
    extern int                               v;
    extern int								 iNbPredicat;
    extern int								 iNbQualificateurs;
    extern int								 iNbPrecondition;
    extern int								 iNbUnivers;
    extern int                               iSize;
    extern std::string						 msg;
    extern std::string						 wrn;
    extern bool								 bAlternative;
    extern bool								 bExcept;
    44 extern SpecificationLoader::CMDBManagerM^ objMDBManager;
    je joins me fichier d'erreurs:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    1>  BuildComponents.cpp
    1>E:\usr\Memoria\dev\Common\com\POSM.h(39): error C3145: 'objPOS'*: une variable globale ou statique ne peut pas avoir de type managé 'SpecificationLoader::CPOSM ^'
    1>          impossible de déclarer une variable globale ou statique, ou un membre d'un type natif faisant référence à des objets du tas gc
    1>E:\usr\Memoria\dev\DBMS\MissionDBManager\com\MissionDatabaseManagerM.h(53): error C3145: 'objMDBManager'*: une variable globale ou statique ne peut pas avoir de type managé 'SpecificationLoader::CMDBManagerM ^'
    1>          impossible de déclarer une variable globale ou statique, ou un membre d'un type natif faisant référence à des objets du tas gc
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(44): error C3145: 'objMDBManager'*: une variable globale ou statique ne peut pas avoir de type managé 'SpecificationLoader::CMDBManagerM ^'
    1>          impossible de déclarer une variable globale ou statique, ou un membre d'un type natif faisant référence à des objets du tas gc
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(1015): warning C4800: 'int'*: valeur forcée à la valeur booléenne 'true' ou 'false' (avertissement sur les performances)
    1>..\..\..\..\Linguistic\Coherence\src\BuildComponents.cpp(1311): warning C4800: 'int'*: valeur forcée à la valeur booléenne 'true' ou 'false' (avertissement sur les performances)
    1>
    1>ÉCHEC de la build.
    mon besoin est d'avoir un accès à la classe MissionDatabseManager pour adresser les méthodes de cette classe. Dans l'histoire de ce produit, j'ai commencé avec Borland bcb puis je suis passé sur Visual Studio avec le code en java, puis j'ai transcrit deux classe de java ne C++ pour des raisons de performance. J'ai alors choisi de passer ces classes en mode managé pour m'abstraire des problèmes d'allocation mémoire.
    Comment accéder aux méthode de la classe MissionDatabaseManager?

  10. #10
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Pourquoi mets-tu tes variables statiques hors des classes? (en faisant ainsi des variables globales locales au fichier qui les contient, au lieu de vraies variables globales au processus mais dans le scope d'une classe)
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  11. #11
    Débutant
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    1 022
    Détails du profil
    Informations personnelles :
    Localisation : France, Mayenne (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2008
    Messages : 1 022
    Points : 332
    Points
    332
    Par défaut la solution
    Excuse moi je ne comprend pas ton thread.
    J'ai tourné le problème résiduel en passant d'un objet au nom de classe
    ainsi j'ai codé:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    	pListLink = CMDBManagerM::getLinks( pEnreg, iOldEnreg);

  12. #12
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Ce que j'ai proposé, c'est au lieu de faire ceci:
    Code C++/CLI : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    	ref class CMDBManagerM
    	{
    	public:
    		CMDBManagerM::CMDBManagerM();
    		CMDBManagerM::~CMDBManagerM();
    ////////////////////////////////////////////////////////////////////////////////
    //  Divers
    ////////////////////////////////////////////////////////////////////////////////
    		List<ElementLinksM^>^ CMDBManagerM::getLinks( ElementSemanticM^ pEnreg, int indice);
    		List<ElementSemanticM^>^  CMDBManagerM::ReadSemanticElements( int iIdDoc);
    	};
    	static SpecificationLoader::CMDBManagerM^ objMDBManager;
    Faire ceci à la place:
    Code C++/CLI : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    	ref class CMDBManagerM
    	{
    	public:
    		CMDBManagerM::CMDBManagerM();
    		CMDBManagerM::~CMDBManagerM();
    ////////////////////////////////////////////////////////////////////////////////
    //  Divers
    ////////////////////////////////////////////////////////////////////////////////
    		List<ElementLinksM^>^ CMDBManagerM::getLinks( ElementSemanticM^ pEnreg, int indice);
    		List<ElementSemanticM^>^  CMDBManagerM::ReadSemanticElements( int iIdDoc);
     
    		static CMDBManagerM^ objMDBManager;
    	};
    Ou même:
    Code C++/CLI : 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
    	ref class CMDBManagerM
    	{
    	public:
    		CMDBManagerM::CMDBManagerM();
    		CMDBManagerM::~CMDBManagerM();
    ////////////////////////////////////////////////////////////////////////////////
    //  Divers
    ////////////////////////////////////////////////////////////////////////////////
    		List<ElementLinksM^>^ CMDBManagerM::getLinks( ElementSemanticM^ pEnreg, int indice);
    		List<ElementSemanticM^>^  CMDBManagerM::ReadSemanticElements( int iIdDoc);
    	};
     
    	public ref class StaticObjects abstract sealed
    	{
    	public:
    		static SpecificationLoader::CMDBManagerM^ objMDBManager;
    	}
    Si ça ne marche pas, j'en serai surpris.
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  13. #13
    Expert éminent sénior
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 074
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Février 2005
    Messages : 5 074
    Points : 12 120
    Points
    12 120
    Par défaut
    Manque pas l'initialisation de objMDBManager dans la dernière version ?

  14. #14
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Elle n'est dans aucune des trois versions que j'ai postées. Mais on peut faire cette initialisation dans un constructeur statique, ou faire un singleton.
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 2
    Dernier message: 21/03/2014, 22h32
  2. Réponses: 3
    Dernier message: 02/02/2012, 15h22
  3. Réponses: 3
    Dernier message: 10/03/2011, 11h45
  4. Erreur de compilation sur une librairie en mode debug
    Par bakaneko dans le forum C++Builder
    Réponses: 2
    Dernier message: 18/05/2006, 16h32
  5. Réponses: 2
    Dernier message: 27/03/2006, 17h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo