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

C++ Discussion :

error LNK2019: symbole externe non résolu


Sujet :

C++

  1. #1
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2014
    Messages : 7
    Points : 4
    Points
    4
    Par défaut error LNK2019: symbole externe non résolu
    Bonjour,

    Je suis actuellement en stage et je dois créer une extension d'agent SNMP. J'ai donc suivi le tutoriel du msdn sur ce sujet que voici:

    https://msdn.microsoft.com/en-us/library/ms927008.aspx

    Je me suis également servis du lien suivant pour créer mon propre header correspondant dans le tutoriel à "testmib.h":

    https://msdn.microsoft.com/en-us/library/ms894548.aspx

    Travaillant avec VisualStudio2012 j'ai rencontré quelques erreurs que j'ai vite corrigées (4 erreurs dont 3 étaient des lnk2019 que j'ai corrigées en ajoutant la lib snmpAPI.lib et une lnk2001 que j'ai fixée).

    En revanche, il me reste une erreur m’empêchant de générer ma solution que voici:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Erreur	1	error LNK2019: symbole externe non résolu "unsigned int __cdecl ResolveVarBind(struct SnmpVarBind *,unsigned int)" (?ResolveVarBind@@YAIPAUSnmpVarBind@@I@Z) référencé dans la fonction _SnmpExtensionQuery@16"
    J'ai beau avoir cherché dans des dizaines de forums et des dizaines de sujets que ça soit en Anglais ou en Français, je ne trouve pas la solution à cette erreur.

    Pour vous aider voici le code qui plante (*.cpp):

    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
    BOOL WINAPI SnmpExtensionQuery (
        IN BYTE requestType,
        IN OUT RFC1157VarBindList *variableBindings ,
        OUT AsnInteger *errorStatus,
    	OUT AsnInteger *errorIndex)
    {
      UINT I;
      static unsigned long requestCount = 0;// Supports the trap simulation
     
      // Iterate through the list of variable bindings to resolve individual
      // variable bindings.
      for (I=0; I < variableBindings->len; I++)
      {
        *errorStatus = ResolveVarBind (&variableBindings->list[I],
                                      requestType);
        // Test and handle the case where Get Next past end of the MIB view that 
        // is supported by this Extension Agent occurs. Special processing is 
        // required to communicate this situation to the Extendible Agent, 
        // so that it can take the appropriate action, possibly querying other 
        // Extension Agents.
        if (*errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME &&
            requestType == MIB_ACTION_GETNEXT)
        {
          *errorStatus = SNMP_ERRORSTATUS_NOERROR;
     
          // Modify variable binding of such variables so the OID points
          // just outside the MIB view that is supported by this Extension Agent.
          // The Extendible Agent tests for this and takes appropriate
          // action.
          SnmpUtilOidFree (&variableBindings->list[I].name);
          SnmpUtilOidCpy (&variableBindings->list[I].name, &MIB_OidPrefix);
          variableBindings->list[I].name.ids[MIB_PREFIX_LEN-1] ++;
        }
     
        // If an error was indicated, communicate error status and error
        // index to the Extendible Agent. The Extendible Agent will ensure
        // that the original variable bindings are returned in the response
        // packet.
        if (*errorStatus != SNMP_ERRORSTATUS_NOERROR)
        {
          *errorIndex = I + 1;
          goto Exit;
        }
      }
    si je commente les lignes suivante, je peux générer ma solution sans soucis:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    *errorStatus = ResolveVarBind (&variableBindings->list[I],
                                      requestType);
    Ça n'est bien évidemment pas la réponse à mon problème mais peut être que ça vous mettra la puce à l'oreille...

    et pour la déclarations des fonctions voici un extrait de mon header:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    // Function Prototypes.
    UINT ResolveVarBind (
      IN OUT RFC1157VarBind *VarBind,       // Variable Binding to resolve
      IN UINT PduAction                     // Action that is specified in PDU
    );
    Merci de bien vouloir m'apporter de l'aide,

    Cordialement,

    MattGran

  2. #2
    Membre émérite
    Avatar de prgasp77
    Homme Profil pro
    Ingénieur en systèmes embarqués
    Inscrit en
    Juin 2004
    Messages
    1 306
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur en systèmes embarqués
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Juin 2004
    Messages : 1 306
    Points : 2 466
    Points
    2 466
    Par défaut
    Bonjour,

    je me souviens à mes débuts, les erreurs d'édition de lien (link) me semblaient autant obscures qu'injustes. Une fois qu'on les comprends, elle perdent complètement leur capacité à nous déstabiliser. "symbole externe non résolu" signifie que dans ton code, tu appelles une fonction déclarée mais non définie. Pour rappel, une déclaration de fonction est ce qu'on trouve généralement dans les fichiers d'en-tête, il y a juste le prototype de la fonction. La définition en revanche est ce qu'on trouve dans les fichiers sources, c'est un rappel du prototype plus son implémentation.

    symbole externe non résolu unsigned int __cdecl ResolveVarBind(struct SnmpVarBind *,unsigned int)
    Cela signifie que tu appelles la fonction non définie ResolveVarBind. Pour rédoudre le problème tu dois dans un premier temps identifier où se trouve l'implémentation de ResolveVarBind. Je suppose ici que ce n'est pas une fonction à toi mais une qui se trouve dans un bibliothèque dont tu as inclus les en-têtes. Dans un second temps, une fois identifié le fichier dans lequel est compilé la fonction (un bibliothèque dynamique --- .dll sous Windows --- une bibliothèque statique --- .lib sous Windows --- ou un fichier objet --- .obj sous Windows), il te "suffit" d'ajouter cette dépendance à ton projet pour résoudre le symbole.

    Bon, il "suffit" est un euphémisme. Car le comment dépend de ta chaîne de compilation. Je vais supposer ici que tu utilises un Microsoft Studio. Voici comment faire :
    • Clic droit sur ton projet dans le "solution explorer" > Propriétés...
    • "Configuration Properties" > "Linker" ;
    • Ajouter le dossier où se trouve ta bibliothèque dans les "Additional Library Directories" ;
    • Ajouter la bibliothèque dans "Additional Dependencies".


    Je fais ça de tête, on a pas forcément la même version ... n'hésite pas à chercher sur google si tu ne trouves pas
    -- Yankel Scialom

  3. #3
    Membre émérite
    Avatar de prgasp77
    Homme Profil pro
    Ingénieur en systèmes embarqués
    Inscrit en
    Juin 2004
    Messages
    1 306
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur en systèmes embarqués
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Juin 2004
    Messages : 1 306
    Points : 2 466
    Points
    2 466
    Par défaut
    Après relecture de ton message, je me dit que ResolveVarBind est peut-être une fonction à toi. Si c'est le cas, vérifie que le fichier source dans lequel elle est définie (le .cpp ou .cc ...) fait bien parti de ton projet.
    -- Yankel Scialom

  4. #4
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2014
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Bonjour prgasp77,

    Tout d'abors merci de consacrer du temps à la résolution de mon problème. Voici une image montrant l'arborescence de mon projet, je pense que ça sera utile pour comprendre l'architecture (minimaliste) de ce dernier:

    Nom : arborescence_projet_Win32DLL.jpg
Affichages : 760
Taille : 19,6 Ko

    Ainsi on s’aperçoit que j'ai bien dans "fichiers sources" le fichier Win32DLL.cpp où se trouve le bout de code qui pose problème. Et si j'ai bien compris ça devrait être dans ce même fichier où devrait se trouver la définition du fameux ResolveVarBind ?

    Il n'y a que deux fichiers sur lesquels je code qui sont Win32DLL.cpp et son fichier d'en-tête Win32DLL.h (ce dernier incluant <snmp.h> et j'ai bien ajouté la lib correspondante snmpAPI.lib à mon projet). Alors à votre avis où peux se trouver cette définition ? dois-je l'ajouter moi même ou ais-je vraiment oublié d'ajouter une dépendance (auquel cas je ne vois vraiment pas laquelle puisque snmpAPI.lib est bien présente) ?

    Voici le code (qui sort tout droit du tutoriel du MSDN) si cela peux vous aider, sachant que le code se trouve à la ligne 153 (histoire que vous n'ayez pas tout à lire ^^).

    Win32DLL.cpp:
    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
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    #include <windows.h>
    #include "stdafx.h" 
    #include "Win32DLL.h"
     
    // Contains the definitions for the table 
                            // structure describing the MIB. This is used 
                            // in conjunction with Testmib.c where the MIB
                            // requests are resolved.
    // Extension-Agent DLLs need access to the time that has elapsed since the agent
    // has been active. This reference is implemented by initializing the Extension 
    // Agent with a time-zero reference, and allowing the agent to compute the 
    // elapsed time by subtracting the time-zero reference from the current
    // system time. This sample Extension Agent implements this reference
    // by using dwTimeZero.
    DWORD dwTimeZero = 0;
     
    // Extension-Agent DLLs that generate traps must create a Win32 Event 
    // object to communicate occurrence of traps to the Extendible Agent.
    // The event handle is given to the Extendible Agent when the Extension
    // Agent is initialized, it should be NULL if traps will not be 
    // generated. This sample Extension Agent simulates the occurrence of 
    // traps by using hSimulateTrap.
    HANDLE hSimulateTrap = NULL;
     
    // This is a standard Win32 DLL entry point. This example DLL does not
    // perform any special actions by using this mechanism.
    BOOL WINAPI DLLEntry (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
    {
      switch (dwReason)
      {
        case DLL_PROCESS_ATTACH:
        case DLL_PROCESS_DETACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        default:
          break;
      } // end switch ()
     
      return TRUE;
    } // end DllEntryPoint ()
     
     
    // Extension-Agent DLLs provide the following entry point to coordinate
    // the initializations of the Extension Agent and the Extendible Agent. 
    // The Extendible Agent provides the Extension Agent with a time-zero 
    // reference; The Extension Agent provides the Extendible Agent with an
    // Event handle for communicating occurrence of traps, and an object 
    // identifier representing the root of the MIB subtree that the 
    // Extension Agent supports.
    BOOL WINAPI SnmpExtensionInit (
        IN  DWORD               dwTimeZeroReference,
        OUT HANDLE              *hPollForTrapEvent,
        OUT AsnObjectIdentifier *supportedView)
    {
      // Record the time-zero reference that is provided by the Extendible Agent.
      dwTimeZero = dwTimeZeroReference;
     
      // Create an Event that will be used to communicate the occurrence of
      // traps to the Extendible Agent. The Extension Agent will assert 
      // this Event when a trap has occurred. This is explained further, 
      // later in this file.
      if ((*hPollForTrapEvent = CreateEvent (NULL, FALSE, FALSE, NULL)) 
          == NULL)
      {
        // Indicate error. Be sure that NULL is returned to the Extendible
        // Agent.
      }
     
      // Indicate the MIB view that is supported by this Extension Agent, an object
      // identifier that represents the sub root of the MIB that is supported.
      *supportedView = MIB_OidPrefix;       // Structure copy
     
      // Record the trap event. This example Extension Agent simulates 
      // traps by generating a trap after every given number of requests 
      // that are processed.
      hSimulateTrap = *hPollForTrapEvent;
     
      // Indicate that initialization of the Extension Agent was successful.
      return TRUE;
    } // end SnmpExtensionInit ()
     
     
    // Extension-Agent DLLs provide the following entry point to 
    // communicate traps to the Extendible Agent. The Extendible Agent will
    // query this entry point when the trap event (which is supplied at 
    // initialization time) is asserted, which indicates that zero or more 
    // traps might have occurred. The Extendible Agent will call repeatedly
    // this entry point until FALSE is returned, which indicates that all 
    // outstanding traps have been processed.
    BOOL WINAPI SnmpExtensionTrap (
        OUT AsnObjectIdentifier *enterprise,
        OUT AsnInteger          *genericTrap,
        OUT AsnInteger          *specificTrap,
        OUT AsnTimeticks        *timeStamp,
        OUT RFC1157VarBindList  *variableBindings)
    {
      // The body of this routine is an extremely simple example of the trap
      // functionality. A real implementation will be more complex.
     
      // The following variables define data that is inserted into the trap below.
      static UINT OidList[]  = { 1, 3, 6, 1, 4, 1, 10388, 0 };
      static UINT OidListLen = 8;
     
      // The following variable is used for the simulation; it allows a 
      // single trap to be generated and then causes FALSE to be returned, 
      // which indicates no more traps.
      static int whichTime = 0;
     
      // The following if/else support the simulation.
      if (whichTime == 0)
      {
        whichTime = 1;                      // Supports the simulation
     
        // Communicate the trap data to the Extendible Agent.
        enterprise->idLength    = OidListLen;
        enterprise->ids         = OidList;
        *genericTrap            = SNMP_GENERICTRAP_ENTERSPECIFIC;
        *specificTrap           = 1;        // the bytesAvailAlert trap
        *timeStamp              = GetTickCount () - dwTimeZero;
        variableBindings->list  = NULL;
        variableBindings->len   = 0;
     
        // Indicate that valid trap data exists in the parameters.
        return TRUE;
      }
      else
      {
        whichTime = 0;                      // Supports the simulation
     
        // Indicate that no more traps are available and parameters do not
        // refer to any valid data.
        return FALSE;
      }
    } // end SnmpExtensionTrap ()
     
     
    // Extension-Agent DLLs provide the following entry point to resolve 
    // queries for MIB variables in their supported MIB view (which is supplied at 
    // initialization time). The requestType is Get/GetNext/Set.
    BOOL WINAPI SnmpExtensionQuery (
        IN BYTE requestType,
        IN OUT RFC1157VarBindList *variableBindings ,
        OUT AsnInteger *errorStatus,
    	OUT AsnInteger *errorIndex)
    {
      UINT I;
      static unsigned long requestCount = 0;// Supports the trap simulation
     
      // Iterate through the list of variable bindings to resolve individual
      // variable bindings.
      for (I=0; I < variableBindings->len; I++)
      {
        *errorStatus = ResolveVarBind (&variableBindings-> list[I], requestType);
     
        // Test and handle the case where Get Next past end of the MIB view that 
        // is supported by this Extension Agent occurs. Special processing is 
        // required to communicate this situation to the Extendible Agent, 
        // so that it can take the appropriate action, possibly querying other 
        // Extension Agents.
        if (*errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME &&
            requestType == MIB_ACTION_GETNEXT)
        {
          *errorStatus = SNMP_ERRORSTATUS_NOERROR;
     
          // Modify variable binding of such variables so the OID points
          // just outside the MIB view that is supported by this Extension Agent.
          // The Extendible Agent tests for this and takes appropriate
          // action.
          SnmpUtilOidFree (&variableBindings->list[I].name);
          SnmpUtilOidCpy (&variableBindings->list[I].name, &MIB_OidPrefix);
          variableBindings->list[I].name.ids[MIB_PREFIX_LEN-1] ++;
        }
     
        // If an error was indicated, communicate error status and error
        // index to the Extendible Agent. The Extendible Agent will ensure
        // that the original variable bindings are returned in the response
        // packet.
        if (*errorStatus != SNMP_ERRORSTATUS_NOERROR)
        {
          *errorIndex = I + 1;
          goto Exit;
        }
      }
     
    Exit:
      // Supports the trap simulation.
      if (++requestCount % 3 == 0 && hSimulateTrap != NULL)
        SetEvent (hSimulateTrap);
     
      // Indicate that Extension-Agent processing was successful.
      return SNMPAPI_NOERROR;
    } // end SnmpExtensionQuery ()
    et Win32DLL.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
    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
     
    /**********************************************************************
    Module Name:
      Win32DLL.h
     
    Abstract:
      Sample MIB Header.
    **********************************************************************/
     
    #ifndef Win32DLL_h
    #define Win32DLL_h
     
    #include <snmp.h>
     
    // MIB Specifics.
    #define MIB_PREFIX_LEN            MIB_OidPrefix.idLength
    #define MAX_STRING_LEN            255
     
    // Ranges and limits for specific MIB variables.
    #define MIB_TOASTER_UP            1
    #define MIB_TOASTER_DOWN          2
     
    #define MIB_TOASTER_LIGHTLYWARM   1
    #define MIB_TOASTER_BURNT         10
     
    #define MIB_TOASTER_WHITEBREAD    1
    #define MIB_TOASTER_OTHERBREAD    7
     
    // MIB function actions.
    #define MIB_ACTION_GET            ASN_RFC1157_GETREQUEST
    #define MIB_ACTION_SET            ASN_RFC1157_SETREQUEST
    #define MIB_ACTION_GETNEXT        ASN_RFC1157_GETNEXTREQUEST
     
    // MIB Variable access privileges.
    #define MIB_ACCESS_READ           0
    #define MIB_ACCESS_WRITE          1
    #define MIB_ACCESS_READWRITE      2
     
    // Macro to determine number of sub-oid's in array.
    #define OID_SIZEOF(Oid)           (sizeof (Oid) / sizeof (UINT))
     
    // MIB variable ENTRY definition. This structure defines the format for
    // each entry in the MIB.
    typedef struct mib_entry
    {
      AsnObjectIdentifier Oid;
      void *              Storage;
      BYTE                Type;
      UINT                Access;
      UINT                (*MibFunc) (UINT, struct mib_entry *,
                          RFC1157VarBind *);
      struct mib_entry *  MibNext;
    } MIB_ENTRY;
     
    // Internal MIB structure.
    extern MIB_ENTRY Mib[];
    extern UINT      MIB_num_variables;
     
    // Prefix to every variable in the MIB.
    AsnObjectIdentifier MIB_OidPrefix;
     
    // Function Prototypes.
    UINT ResolveVarBind (
      IN OUT RFC1157VarBind *VarBind,       // Variable Binding to resolve
      IN UINT PduAction                     // Action that is specified in PDU
    );
     
    UINT MIB_leaf_func (
      IN UINT Action,
      IN MIB_ENTRY *MibPtr,
      IN RFC1157VarBind *VarBind
    );
     
    UINT MIB_control_func (
      IN UINT Action,
      IN MIB_ENTRY *MibPtr,
      IN RFC1157VarBind *VarBind
    );
     
    UINT MIB_doneness_func (
      IN UINT Action,
      IN MIB_ENTRY *MibPtr,
      IN RFC1157VarBind *VarBind
    );
     
    UINT MIB_toasttype_func (
      IN UINT Action,
      IN MIB_ENTRY *MibPtr,
      IN RFC1157VarBind *VarBind
    );
     
    #endif // Win32DLL
    D'avance merci.

  5. #5
    Membre émérite
    Avatar de prgasp77
    Homme Profil pro
    Ingénieur en systèmes embarqués
    Inscrit en
    Juin 2004
    Messages
    1 306
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur en systèmes embarqués
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Juin 2004
    Messages : 1 306
    Points : 2 466
    Points
    2 466
    Par défaut
    Effectivement, je n'avais pas analysé ton code assez loin. Je te mets en évidence le problème et je te laisse conclure

    symbole externe non résolu unsigned int __cdecl ResolveVarBind(struct SnmpVarBind *,unsigned int)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    UINT ResolveVarBind (
      IN OUT RFC1157VarBind *VarBind,       // Variable Binding to resolve
      IN UINT PduAction                     // Action that is specified in PDU
    );
    -- Yankel Scialom

  6. #6
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2014
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Je viens de remplacer
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    UINT ResolveVarBind (
      IN OUT RFC1157VarBind *VarBind,
      IN UINT PduAction
    );
    par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    UINT ResolveVarBind (
      IN OUT SnmpVarBind *VarBind,
      IN UINT PduAction
    );
    mais j'ai toujours la même erreur

  7. #7
    Rédacteur/Modérateur


    Homme Profil pro
    Network game programmer
    Inscrit en
    Juin 2010
    Messages
    7 115
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Canada

    Informations professionnelles :
    Activité : Network game programmer

    Informations forums :
    Inscription : Juin 2010
    Messages : 7 115
    Points : 32 967
    Points
    32 967
    Billets dans le blog
    4
    Par défaut
    Rien a voir mais : l'arborescence des fichiers dans Visual n'a rien a voir avec l'arborescence reelle du projet.
    Pour la compilation c'est l'arbo sur le disque qui importe.
    Pensez à consulter la FAQ ou les cours et tutoriels de la section C++.
    Un peu de programmation réseau ?
    Aucune aide via MP ne sera dispensée. Merci d'utiliser les forums prévus à cet effet.

  8. #8
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2014
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Ah d'accord autant pour moi, j'en prend bien note! merci pour la précision

  9. #9
    Membre émérite
    Avatar de prgasp77
    Homme Profil pro
    Ingénieur en systèmes embarqués
    Inscrit en
    Juin 2004
    Messages
    1 306
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur en systèmes embarqués
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Juin 2004
    Messages : 1 306
    Points : 2 466
    Points
    2 466
    Par défaut
    Citation Envoyé par MattGran Voir le message
    j'ai toujours la même erreur
    Il te reste plus qu'à définir la fonction . Tu n'as fait que la déclarer.
    -- Yankel Scialom

  10. #10
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2014
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Je n'arrive pas à définir cette fonction étant donnée que c'est une fonction qui apparaît dans le tutoriel que j'ai suivi je ne sais pas quoi mettre dans le corps de la fonction... ni même où la définir :/

    EDIT: Je viens de trouver ça sur MSDN

    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
    UINT ResolveVarBind (
        IN OUT RFC1157VarBind *VarBind, // Variable Binding to resolve
        IN UINT PduAction)              // Action that is specified in PDU
    {
      MIB_ENTRY            *MibPtr;
      AsnObjectIdentifier  TempOid;
      int                  CompResult;
      UINT                 I;
      UINT                 nResult;
     
      // Search for var bind name in the MIB
      I      = 0;
      MibPtr = NULL;
      while (MibPtr == NULL && I < MIB_num_variables)
      {
        // Construct OID with complete prefix for comparison purposes
        SnmpUtilOidCpy (&TempOid, &MIB_OidPrefix);
        SnmpUtilOidAppend (&TempOid, &Mib[I].Oid);
     
        // Check for OID in MIB - On a GET-NEXT the OID does not have to 
        // match exactly a variable in the MIB, it must fall only under 
        // the MIB root.
        CompResult = SnmpUtilOidCmp (&VarBind->name, &TempOid);
        if (0 > CompResult)
        {
          // Because there is not an exact match, the only valid action is 
          // GET-NEXT
          if (MIB_ACTION_GETNEXT != PduAction)
          {
            nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
          }
     
          // Because the match was not exact, but varbind name is within MIB,
          // you are at the NEXT MIB variable down from the one that was specified.
          PduAction = MIB_ACTION_GET;
          MibPtr = &Mib[I];
     
          // Replace var bind name with new name
          SnmpUtilOidFree (&VarBind->name);
          SnmpUtilOidCpy (&VarBind->name, &MIB_OidPrefix);
          SnmpUtilOidAppend (&VarBind->name, &MibPtr->Oid);
        }
        else
        {
          // An exact match was found.
          if (0 == CompResult)
            MibPtr = &Mib[I];
        }
     
        // Free OID memory before checking another variable
        SnmpUtilOidFree (&TempOid);
     
        I++;
      } // while
     
      // If OID not within scope of MIB, then no such name
      if (MibPtr == NULL)
      {
        nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
        goto Exit;
      }
     
      // Call function to process request. Each MIB entry has a function 
      // pointer that knows how to process its MIB variable.
      nResult = (*MibPtr->MibFunc) (PduAction, MibPtr, VarBind);
     
      // Free temp memory
      SnmpUtilOidFree (&TempOid);
     
    Exit:
       return nResult;
    } // ResolveVarBind
    serait-ce la définition dont on parle ? En tout cas je l'ai mise dans mon fichier d'en-tête et il me donne deux nouvelles erreurs...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    error LNK2001: symbole externe non résolu "struct mib_entry * Mib" (?Mib@@3PAUmib_entry@@A)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    error LNK2001: symbole externe non résolu "unsigned int MIB_num_variables" (?MIB_num_variables@@3IA)
    n'y arriverais-je donc jamais ?

  11. #11
    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 123
    Points
    12 123
    Par défaut
    https://msdn.microsoft.com/en-us/library/aa909968.aspx
    etc...

    Tu devrais assimiler et comprendre TOUT le tutoriel avant de foncer tête baissée.

    Don't Panic!!!

Discussions similaires

  1. Réponses: 2
    Dernier message: 21/10/2010, 10h23
  2. error LNK2019: symbole externe non résolu
    Par sheep_one dans le forum Windows
    Réponses: 0
    Dernier message: 03/06/2010, 11h03
  3. error LNK2019: symbole externe non résolu
    Par Halloula dans le forum Visual C++
    Réponses: 3
    Dernier message: 28/11/2009, 02h19
  4. error LNK2019: symbole externe non résolu
    Par bugmenot dans le forum Visual C++
    Réponses: 6
    Dernier message: 24/11/2009, 01h02
  5. error LNK2019: symbole externe non résolu "void __cdecl MaFonction
    Par lolo le belge dans le forum Visual C++
    Réponses: 3
    Dernier message: 30/10/2009, 11h38

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