définition de dllimport la fonction n'est pas autorisée

Lors de la compilation d'un code en C, j'obtiens l'erreur suivante:

c:\users\kbarman\documents\mser\vlfeat-0.9.13-try\mser\stringop.c(71): error C2491: 'vl_string_parse_protocol' : definition of dllimport function not allowed

Dans le fichier stringop.c, j'ai la fonction suivante:

VL_EXPORT char *
vl_string_parse_protocol (char const *string, int *protocol)
{
  char const * cpt ;
  int dummy ;

  /* handle the case prot = 0 */
  if (protocol == 0)
    protocol = &dummy ;

  /* look for ://*/
  cpt = strstr(string, "://") ;

  if (cpt == 0) {
    *protocol = VL_PROT_NONE ;
    cpt = string ;
  }
  else {
    if (strncmp(string, "ascii", cpt - string) == 0) {
      *protocol = VL_PROT_ASCII ;
    }
    else if (strncmp(string, "bin",   cpt - string) == 0) {
      *protocol = VL_PROT_BINARY ;
    }
    else {
      *protocol = VL_PROT_UNKNOWN ;
    }
    cpt += 3 ;
  }
  return (char*) cpt ;
}

Et VL_EXPORT est définie comme suit:

#      define VL_EXPORT extern "C" __declspec(dllimport)

Quelqu'un peut-il me dire quelle est la cause de cette erreur et comment je peux me débarrasser de lui?

Chercher à partir de ce #define, il y a un #ifdef qui sélectionne entre dllexport et dllimport. Vous avez besoin dllexport ici afin de définir cette macro.

OriginalL'auteur user979791 | 2011-10-05