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

Windows Discussion :

GNet & Windows


Sujet :

Windows

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 12
    Points : 7
    Points
    7
    Par défaut GNet & Windows
    Bonjour,

    Je cherche une lib multi-platform (Linux/Mac/Win) compatible GTK.

    J'ai trouvé GNet mais je n'arrive pas à l'utilisé sous windows :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    gnet_tcp_socket_get_io_channel' : undeclared identifier
    '=' : cannot convert from 'int' to 'struct _GIOChannel *'
    Une personne pourrais m'aider pour l'installation (car a priori j'ai du loupé un truc) ou sont utilisation ?

    Merci, Jielde.

  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 518
    Points
    41 518
    Par défaut
    Le header qui déclare ladite fonction est-il bien inclus, au moins ?
    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
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 12
    Points : 7
    Points
    7
    Par défaut
    Citation Envoyé par Médinoc
    Le header qui déclare ladite fonction est-il bien inclus, au moins ?
    J'ai trouver cet exemple :

    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
    /* Echo client
     * Copyright (C) 2000-2001  David Helder
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     */
    
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #include "glib.h"
    #include "gnet.h"
    
    #define gnet_tcp_socket_get_io_channel gnet_tcp_socket_get_iochannel;
    
    
    int
    main(int argc, char** argv)
    {
      gchar* hostname;
      gint port;
      GInetAddr* addr;
      GTcpSocket* socket;
      GIOChannel* iochannel;
      GIOError error = G_IO_ERROR_NONE;
      gchar buffer[1024];
      guint n;
    
      gnet_init ();
    
      /* Parse args */
      if (argc != 3)
        {  
          g_print ("usage: %s <server> <port>\n", argv[0]);
          exit(EXIT_FAILURE);
        }
      hostname = argv[1];
      port = atoi(argv[2]);
    
      /* Create the address */
      addr = gnet_inetaddr_new (hostname, port);
      if (!addr)
        {
          fprintf (stderr, "Error: Name lookup for %s failed\n", hostname);
          exit (EXIT_FAILURE);
        }
    
      /* Create the socket */
      socket = gnet_tcp_socket_new (addr);
      gnet_inetaddr_delete (addr);
      if (!socket)
        {
          fprintf (stderr, "Error: Could not connect to %s:%d\n", hostname, port);
          exit (EXIT_FAILURE);
        }
    
    #if 0
      {
        gchar* cname;
    
        /* Print local address */
        addr = gnet_tcp_socket_get_local_inetaddr (socket);
        g_assert (addr);
        cname = gnet_inetaddr_get_canonical_name (addr);
        g_assert (cname);
        g_print ("Local address: %s:%d\n", cname, gnet_inetaddr_get_port(addr));
        g_free (cname);
        gnet_inetaddr_delete (addr);
    
        /* Print remote address */
        addr = gnet_tcp_socket_get_remote_inetaddr (socket);
        g_assert (addr);
        cname = gnet_inetaddr_get_canonical_name (addr);
        g_assert (cname);
        g_print ("Remote address: %s:%d\n", cname, gnet_inetaddr_get_port(addr));
        g_free (cname);
        gnet_inetaddr_delete (addr);
      }
    #endif
    
      /* Get the IOChannel */
      iochannel = gnet_tcp_socket_get_io_channel (socket);
      g_assert (iochannel != NULL);
    
      while (fgets(buffer, sizeof(buffer), stdin) != 0)
        {
          n = strlen(buffer);
          error = gnet_io_channel_writen (iochannel, buffer, n, &n);
          if (error != G_IO_ERROR_NONE) break;
    
          error = gnet_io_channel_readn (iochannel, buffer, n, &n);
          if (error != G_IO_ERROR_NONE) break;
    
          fwrite(buffer, n, 1, stdout);
        }
    
      if (error != G_IO_ERROR_NONE) 
        fprintf (stderr, "Error: IO error (%d)\n", error);
    
      gnet_tcp_socket_delete (socket);
    
      return 0;
    }
    Maintenant j'ai plus de problème pour gnet_tcp_socket_get_io_channel' : undeclared identifier.

    Mais j'ai toujours le problème pour ceci :

    '=' : cannot convert from 'struct _GIOChannel *(__cdecl *)(struct _GTcpSocket *)' to 'struct _GIOChannel *'
    There is no context in which this conversion is possible

  4. #4
    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 518
    Points
    41 518
    Par défaut
    1. Fonction séparée de sa parenthèse: Beurk! Y'a vraiment des gens qui trouvent ça lisible ?
    2. On dirait que tu cherches à affecter une fonction à une variable. Généralement, ça arrive quand on oublie les parenthèses lors d'un appel de fonction.
    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.

Discussions similaires

  1. [Wamp] Choix d'un AMP de production Windows
    Par Helyopses dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 6
    Dernier message: 30/12/2011, 10h05
  2. Documentation gratuite sur l'API Windows, COM, DCOM, OLE, etc.
    Par Community Management dans le forum Windows
    Réponses: 1
    Dernier message: 16/11/2006, 15h28

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