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

Langage C++ Discussion :

Problème de namespace


Sujet :

Langage C++

  1. #1
    Membre averti
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2008
    Messages
    38
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Avril 2008
    Messages : 38
    Par défaut Problème de namespace
    Bonjour, donc moi j'ai un petit soucis que je ne comprends pas, à la compilation j'obtiens les erreurs suivantes:

    1> Creating library ..\..\Lib\Win32\Debug\plgVisiProcess.lib and object ..\..\Lib\Win32\Debug\plgVisiProcess.exp
    1>vsUtils.obj : error LNK2019: unresolved external symbol "void __cdecl vs::vsSubdivideShapes(class vs::ConvexCell *,class mgf::Vector4<float>,float,bool,class vs::ConvexCell *,class vs::ConvexCell *)" (?vsSubdivideShapes@vs@@YAXPAVConvexCell@1@V?$Vector4@M@mgf@@M_N00@Z) referenced in function "bool __cdecl vsSubdivideCell(class vs::ConvexCell *,class mgf::Vector4<float>,float,bool,class std::vector<class vs::ConvexCell *,class std::allocator<class vs::ConvexCell *> > &)" (?vsSubdivideCell@@YA_NPAVConvexCell@vs@@V?$Vector4@M@mgf@@M_NAAV?$vector@PAVConvexCell@vs@@V?$allocator@PAVConvexCell@vs@@@std@@@std@@@Z)
    1>vsUtils.obj : error LNK2019: unresolved external symbol "bool __cdecl vs::vsSubdivideHulls(class vs::ConvexCell *,class mgf::Vector4<float>,float,class vs::ConvexCell *,class vs::ConvexCell *)" (?vsSubdivideHulls@vs@@YA_NPAVConvexCell@1@V?$Vector4@M@mgf@@M00@Z) referenced in function "bool __cdecl vsSubdivideCell(class vs::ConvexCell *,class mgf::Vector4<float>,float,bool,class std::vector<class vs::ConvexCell *,class std::allocator<class vs::ConvexCell *> > &)" (?vsSubdivideCell@@YA_NPAVConvexCell@vs@@V?$Vector4@M@mgf@@M_NAAV?$vector@PAVConvexCell@vs@@V?$allocator@PAVConvexCell@vs@@@std@@@std@@@Z)
    1>vsUtils.obj : error LNK2019: unresolved external symbol "void __cdecl vs::vsSubdivideShape(class vrgl::Shape *,class mgf::Vector4<float>,float,bool,class std::vector<class vrml::Node *,class std::allocator<class vrml::Node *> > &,class std::vector<class vrml::Node *,class std::allocator<class vrml::Node *> > &)" (?vsSubdivideShape@vs@@YAXPAVShape@vrgl@@V?$Vector4@M@mgf@@M_NAAV?$vector@PAVNode@vrml@@V?$allocator@PAVNode@vrml@@@std@@@std@@3@Z) referenced in function "void __cdecl vsSubdivideShapes(class vs::ConvexCell *,class mgf::Vector4<float>,float,bool,class vs::ConvexCell *,class vs::ConvexCell *)" (?vsSubdivideShapes@@YAXPAVConvexCell@vs@@V?$Vector4@M@mgf@@M_N00@Z)
    1>..\..\Lib\Win32\Debug\plgVisiProcess.dll : fatal error LNK1120: 3 unresolved externals
    Mon .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
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    #ifndef _VS_PROCESS_UTILS_H_
    #define _VS_PROCESS_UTILS_H_
     
    // Magellan Library
    #include <mgf.h>
     
    // VRML97
    #include <vrml.h>
    #include <vrgl.h>
     
     
    #include "vsStream.h"
    #include "vsProcessDll.h"
     
     
    namespace vs {
     
    	VS_PROCESS_EXPORT bool vsSubdivideCell( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool notTwinPoly, std::vector< ConvexCell* >& cellList );
     
     
    	VS_PROCESS_EXPORT bool vsSubdivideHulls( ConvexCell* cell, mgf::Vector4f plane, float thickCut, ConvexCell* left, ConvexCell* right );
     
     
    	VS_PROCESS_EXPORT void vsSubdivideShapes( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool notTwinPoly, ConvexCell* left, ConvexCell* right );
     
    	VS_PROCESS_EXPORT void vsSubdivideShape( vrgl::Shape* shape, mgf::Vector4f plane, float thickCut, bool notTwinPoly, std::vector<vrml::Node*>& left, std::vector<vrml::Node*>& right );
     
    }
     
    #endif
    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
    #include "Utilities/vsUtils.h"
     
    using namespace vs;
     
    bool vsSubdivideCell( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool noTwinPoly, std::vector< ConvexCell* >& cellList ){
     
    //Code
     
    }
     
    bool vsSubdivideHulls( ConvexCell* cell, mgf::Vector4f plane, float thickCut, ConvexCell* left, ConvexCell* right ){
     
    //Code
     
    }
     
    void vsSubdivideShapes( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool noTwinPoly, ConvexCell* left, ConvexCell* right ){
     
    //Code
     
    }
     
    void vsSubdivideShape( vrgl::Shape* shape, mgf::Vector4f plane, float thickCut, bool noTwinPoly, std::vector<vrml::Node*>& left, std::vector<vrml::Node*>& right ){
     
    //code
     
    }
    Le problème est qu'il ne me met aucune erreur de link sur la première fonction mais toutes les autres en ont. De plus si je rajoute vs:: devant la fonction dans le .cpp je n'ai plus d'erreur. J'utilise pourtant bien le en haut de mon .cpp.

    Je ne comprends vraiment pas quel pourrait être le problème.

    Merci d'avance.

  2. #2
    Membre éclairé
    Avatar de Floréal
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    456
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 456
    Par défaut
    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
    #include "Utilities/vsUtils.h"
     
    namespace vs {
     
      bool vsSubdivideCell( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool noTwinPoly, std::vector< ConvexCell* >& cellList ){
     
        //Code
     
      }
     
      bool vsSubdivideHulls( ConvexCell* cell, mgf::Vector4f plane, float thickCut, ConvexCell* left, ConvexCell* right ){
     
        //Code
     
      }
     
      void vsSubdivideShapes( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool noTwinPoly, ConvexCell* left, ConvexCell* right ){
     
        //Code
     
      }
     
      void vsSubdivideShape( vrgl::Shape* shape, mgf::Vector4f plane, float thickCut, bool noTwinPoly, std::vector<vrml::Node*>& left, std::vector<vrml::Node*>& right ){
     
        //code
     
      }
    }
    comme son nom l'indique, using permet d'utiliser des identificateurs d'un namespace, pas de les déclarer ou de définir/implémenter ce qu'il fonts.

  3. #3
    Expert confirmé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    5 487
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Val de Marne (Île de France)

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

    Informations forums :
    Inscription : Février 2005
    Messages : 5 487
    Par défaut
    vous confondez :
    et
    Le premier extrait demande au compilateur d'aller voir dans l'espace de nom "vs" les symboles qu'il ne trouve pas dans l'espace de nom anonyme ou dans l'espace de nom courant.

    Le second extrait indique que tous les symboles définis entre l'accolade ouvrante et l'accolade fermante, feront partie du namespace "vs".

    Il y a donc incohérence entre votre fichier d'en-tête qui spécifie que les fonctions sont dans l'espace "vs" et votre code qui définit les fonctions dans l'espace de nom anonyme.

    Ce code devrait mieux fonctionner.

    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
    #include "Utilities/vsUtils.h"
     
    namespace vs
    {
     
    bool vsSubdivideCell( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool noTwinPoly, std::vector< ConvexCell* >& cellList ){
     
    //Code
     
    }
     
    bool vsSubdivideHulls( ConvexCell* cell, mgf::Vector4f plane, float thickCut, ConvexCell* left, ConvexCell* right ){
     
    //Code
     
    }
     
    void vsSubdivideShapes( ConvexCell* cell, mgf::Vector4f plane, float thickCut, bool noTwinPoly, ConvexCell* left, ConvexCell* right ){
     
    //Code
     
    }
     
    void vsSubdivideShape( vrgl::Shape* shape, mgf::Vector4f plane, float thickCut, bool noTwinPoly, std::vector<vrml::Node*>& left, std::vector<vrml::Node*>& right ){
     
    //code
     
    }
     
    }

  4. #4
    Membre averti
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2008
    Messages
    38
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Avril 2008
    Messages : 38
    Par défaut
    Ok merci beaucoup!

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

Discussions similaires

  1. [XSLT]Problème de namespace sur un export XMi (UML 2.1/XMi 2.1)
    Par CocoRambo dans le forum XSL/XSLT/XPATH
    Réponses: 3
    Dernier message: 25/06/2007, 09h50
  2. problème de namespace
    Par deubelte dans le forum C++
    Réponses: 10
    Dernier message: 30/05/2007, 12h48
  3. [C#/.NET 2.0] Problème de namespace/référence
    Par Tetram165 dans le forum Services Web
    Réponses: 2
    Dernier message: 05/01/2007, 01h55
  4. [XSD] Problème de namespace
    Par pierrelm dans le forum Valider
    Réponses: 3
    Dernier message: 14/09/2006, 01h19
  5. [DOM] Problème de namespace
    Par dauggui dans le forum Format d'échange (XML, JSON...)
    Réponses: 1
    Dernier message: 26/04/2006, 07h22

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