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

SL & STL C++ Discussion :

Problème STL : error C2064: term does not evaluate to a function taking 1 arguments


Sujet :

SL & STL C++

  1. #1
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2007
    Messages
    387
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

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

    Informations forums :
    Inscription : Janvier 2007
    Messages : 387
    Points : 301
    Points
    301
    Par défaut Problème STL : error C2064: term does not evaluate to a function taking 1 arguments
    Bonjour,

    J'ai une erreur de compilateur que je ne parviens pas à résoudre, pourriez-vous m'aider :

    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
    template<class InIt,class Pr> 
    inline InIt _find_if(InIt First, InIt Last, Pr Pred)
    {	// find first satisfying _Pred
       _DEBUG_RANGE(First, Last);
       _DEBUG_POINTER(Pred);
       for (; First != Last; ++First)
    	if (Pred(*First))        <----- Problème ici
                       break;
       return (First);
    }
     
    template<class InIt, class Pr> 
    inline InIt find_if(InIt First, InIt Last, Pr Pred)
    {	// find first satisfying _Pred
       _ASSIGN_FROM_BASE(First,_find_if(_CHECKED_BASE(First), _CHECKED_BASE(Last), Pred));
       return (First);
    }

    Ca me fait : error C2064: term does not evaluate to a function taking 1 arguments

  2. #2
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    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 379
    Points : 41 573
    Points
    41 573
    Par défaut

    Tu peux nous montrer l'utilisation ?
    Les templates ne sont pas évalués avant celle-ci sous Visual...

  3. #3
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2007
    Messages
    387
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

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

    Informations forums :
    Inscription : Janvier 2007
    Messages : 387
    Points : 301
    Points
    301
    Par défaut
    iterator first = std::find_if(begin(), end(), rak::less_equal(r.first, rak::const_mem_ref(&value_type::second)));

    iterator last = std::find_if(first, end(), rak::less(first->second, rak::const_mem_ref(&value_type::second)));

    notamment, c'est utilisé une trentaine de fois dans mon programme.

  4. #4
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    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 379
    Points : 41 573
    Points
    41 573
    Par défaut
    rak::less ou rak::less_equal n'est pas du bon type ou n'implémenta pas l'opérateur ().

    Poste (ou essaie de comprendre) le message d'erreur complet, que tu trouveras dans la fenêtre de sortie (Output Window). Normalement, il fait plusieurs lignes, et la fenêtre d'erreurs n'affiche que la première.

  5. #5
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2007
    Messages
    387
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

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

    Informations forums :
    Inscription : Janvier 2007
    Messages : 387
    Points : 301
    Points
    301
    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
    29
    30
    31
    32
    33
    34
    35
    36
    Compiling...
    request_list.cc
    d:\src\torrent\data\block.h(67) : warning C4267: 'return' : conversion from 'size_t' to 'torrent::Block::size_type', possible loss of data
    d:\libtorrent-0.11.1\src\torrent\bitfield.h(93) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\libtorrent-0.11.1\src\torrent\bitfield.h(103) : warning C4244: 'return' : conversion from '__w64 int' to 'torrent::Bitfield::size_type', possible loss of data
    connection_list.cc
    d:\inet\rak\socket_address.h(614) : warning C4800: 'char *' : forcing value to bool 'true' or 'false' (performance warning)
    d:\inet\rak\socket_address.h(619) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\src\rak\error_number.h(68) : warning C4996: 'strerror' was declared deprecated
            c:\program files\microsoft visual studio 8\vc\include\string.h(125) : see declaration of 'strerror'
            Message: 'This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    d:\libtorrent-0.11.1\src\data\chunk_list_node.h(65) : warning C4800: 'torrent::Chunk *const ' : forcing value to bool 'true' or 'false' (performance warning)
    d:\libtorrent-0.11.1\src\torrent\bitfield.h(93) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\src\openssl\rc4.h(70) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
    d:\libtorrent-0.11.1\src\torrent\peer\peer_info.h(60) : warning C4800: 'const int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\libtorrent-0.11.1\src\torrent\peer\peer_info.h(61) : warning C4800: 'const int' : forcing value to bool 'true' or 'false' (performance warning)
    c:\program files\microsoft visual studio 8\vc\include\algorithm(107) : error C2064: term does not evaluate to a function taking 1 arguments
            c:\program files\microsoft visual studio 8\vc\include\algorithm(115) : see reference to function template instantiation 'InIt std::_find_if,Pr>(InIt,InIt,Pr)' being compiled
            with
            [
                InIt=std::_Vector_iterator>,
                _Ty=torrent::PeerConnectionBase *,
                _Alloc=std::allocator,
                Pr=rak::equal_ptr_t,std::const_mem_fun_t>>
            ]
            d:\src\connection_list.cc(160) : see reference to function template instantiation 'InIt std::find_if,rak::equal_ptr_t>(InIt,InIt,Pr)' being compiled
            with
            [
                InIt=std::_Vector_iterator>,
                _Ty=torrent::PeerConnectionBase *,
                _Alloc=std::allocator,
                Type=const rak::socket_address,
                Ftor=rak::on_t,std::const_mem_fun_t>,
                Pr=rak::equal_ptr_t,std::const_mem_fun_t>>
            ]
    Generating Code...


    Mais d'après toi, cela viendrait du fait qu'il manque un opérateur() ?????

  6. #6
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    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 379
    Points : 41 573
    Points
    41 573
    Par défaut
    Edite ton poste en re-postant le message d'erreur avec la balise "code", car tous tes symboles '<' ont été effacés...

  7. #7
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2007
    Messages
    387
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

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

    Informations forums :
    Inscription : Janvier 2007
    Messages : 387
    Points : 301
    Points
    301
    Par défaut
    voila, c'est fait.

  8. #8
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    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 379
    Points : 41 573
    Points
    41 573
    Par défaut
    1. Tu es sûr que tu as RE-posté ? Je ne vois pas beaucoup de '<'....
    2. Vérifie rak::equal_ptr_t. S'il ne contient pas d'opérateur () public à un seul paramètre, ce n'est pas un prédicat valide.

  9. #9
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2007
    Messages
    387
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

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

    Informations forums :
    Inscription : Janvier 2007
    Messages : 387
    Points : 301
    Points
    301
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
     
    Compiling...
    request_list.cc
    d:\src\torrent\data\block.h(67) : warning C4267: 'return' : conversion from 'size_t' to 'torrent::Block::size_type', possible loss of data
    d:\libtorrent-0.11.1\src\torrent\bitfield.h(93) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\libtorrent-0.11.1\src\torrent\bitfield.h(103) : warning C4244: 'return' : conversion from '__w64 int' to 'torrent::Bitfield::size_type', possible loss of data
    connection_list.cc
    d:\inet\rak\socket_address.h(614) : warning C4800: 'char *' : forcing value to bool 'true' or 'false' (performance warning)
    d:\inet\rak\socket_address.h(619) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\src\rak\error_number.h(68) : warning C4996: 'strerror' was declared deprecated
            c:\program files\microsoft visual studio 8\vc\include\string.h(125) : see declaration of 'strerror'
            Message: 'This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
    d:\libtorrent-0.11.1\src\data\chunk_list_node.h(65) : warning C4800: 'torrent::Chunk *const ' : forcing value to bool 'true' or 'false' (performance warning)
    d:\libtorrent-0.11.1\src\torrent\bitfield.h(93) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\src\openssl\rc4.h(70) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
    d:\libtorrent-0.11.1\src\torrent\peer\peer_info.h(60) : warning C4800: 'const int' : forcing value to bool 'true' or 'false' (performance warning)
    d:\libtorrent-0.11.1\src\torrent\peer\peer_info.h(61) : warning C4800: 'const int' : forcing value to bool 'true' or 'false' (performance warning)
    c:\program files\microsoft visual studio 8\vc\include\algorithm(107) : error C2064: term does not evaluate to a function taking 1 arguments
            c:\program files\microsoft visual studio 8\vc\include\algorithm(115) : see reference to function template instantiation 'InIt std::_find_if,Pr>(InIt,InIt,Pr)' being compiled
            with
            [
                InIt=std::_Vector_iterator>,
                _Ty=torrent::PeerConnectionBase *,
                _Alloc=std::allocator,
                Pr=rak::equal_ptr_t,std::const_mem_fun_t>>
            ]
            d:\src\connection_list.cc(160) : see reference to function template instantiation 'InIt std::find_if,rak::equal_ptr_t>(InIt,InIt,Pr)' being compiled
            with
            [
                InIt=std::_Vector_iterator>,
                _Ty=torrent::PeerConnectionBase *,
                _Alloc=std::allocator,
                Type=const rak::socket_address,
                Ftor=rak::on_t,std::const_mem_fun_t>,
                Pr=rak::equal_ptr_t,std::const_mem_fun_t>>
            ]
    Generating Code...

    Re-voilà.

  10. #10
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 379
    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 379
    Points : 41 573
    Points
    41 573
    Par défaut
    Eh bien, je ne peux pas te dire grand-chose de plus.
    Vérifie mon point 2...

  11. #11
    Membre averti
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2007
    Messages
    387
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

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

    Informations forums :
    Inscription : Janvier 2007
    Messages : 387
    Points : 301
    Points
    301
    Par défaut
    Je ne sais pas comment j'ai fait, mais ca marche maintenant.
    Dès que je retrouve d'où venait le problème, je le poste.

  12. #12
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Août 2010
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Août 2010
    Messages : 1
    Points : 1
    Points
    1
    Par défaut
    Bonjour à tous,
    J'ai rencontrer le même titre d'erreur qu'énoncé ci-dessus. Et je suis parvenu à le résoudre. Pour les suivants qui passeront, je vous explique mon problème.

    Je code en C et le compilo me donne ce message d'erreur:
    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    error C2064: term does not evaluate to a function
    au niveau de l'instruction (*pNbOuvrier)++; du code que voici:
    Code C : 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
    void AjoutOuvrier (INDEX_OUVRIER *pTeteIndex, long *pNbOuvrier, FICHE_OUVRIER *pAjout)
    {
    	FILE *fp = NULL;
    	INDEX_OUVRIER Ajout;
    	long Offset = (pTeteIndex + *pNbOuvrier)->Offset;
     
    	if(fp = fopen(FICHIER_OUVRIER,"wb"))//Ajout dans le fichier
    	{
    		fseek(fp, Offset, SEEK_SET);
    		fwrite(pAjout, sizeof(FICHE_OUVRIER), 1, fp);
    		fclose(fp);
    		AffecterIndexOuvrier(&Ajout, Offset, pAjout->NumRegistre, pAjout->Nom, pAjout->Prenom, pAjout->CodePostal, pAjout->Specialite)
    		(*pNbOuvrier)++;
    		printf("\n%s %s vient d\'etre ajoute\n", pAjout->Nom, pAjout->Prenom);
    	}
    	else//Ajout non effectue
    	{
    		printf("Erreur d\'ecriture du fichier \"%s\"\n%d: %s\n", FICHIER_OUVRIER, errno, strerror(errno));
    		printf("\nL\'ajout de %s %s\nn\'a pu etre effectue.\n", pAjout->Nom, pAjout->Prenom);
    		exit(EXIT_FAILURE);
    	}
    }
    Si vous regardez la ligne juste au-dessus, l'instruction ne se termine pas par un point-virgule, d'où le message d'erreur. Voilà, erreur résolue

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

Discussions similaires

  1. Réponses: 2
    Dernier message: 21/05/2009, 10h03
  2. Xbap error : That assembly does not allow partially trusted callers
    Par amandinerenard dans le forum Windows Presentation Foundation
    Réponses: 1
    Dernier message: 02/07/2008, 22h31
  3. Réponses: 2
    Dernier message: 24/04/2008, 15h31
  4. error: ISO C++ does not support `long long'
    Par Suryavarman dans le forum Code::Blocks
    Réponses: 3
    Dernier message: 13/02/2007, 23h27
  5. ERROR: relation "MaTable" does not exist (pgAdmin
    Par Népomucène dans le forum PostgreSQL
    Réponses: 2
    Dernier message: 01/02/2006, 14h17

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