Hello,

J'ai une petite appli qui a été développée sous Ubuntu, avec Eclipse. Elle compile sans problème, fonctionne (c'est uniquement du test pour le moment).

la, je voudrais la faire compiler sous Debian, avec g++, afin de continuer à développer sous cet environnement (qui sera le final, et parce que j'en ai marre de devoir relancer 25 fois eclipse par jour...).

Soit, je transferrt les données sur mon serveur, et je lance la compilation avec g++

Code : Sélectionner tout - Visualiser dans une fenêtre à part
g++ -o udp_client udp_client.cpp
Et la, j'obtiens un beau
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
/tmp/ccC2sWxO.o: In function `main':
udp_client.cpp:(.text+0x1cf): undefined reference to `test::Tube_Info::Tube_Info()'
udp_client.cpp:(.text+0x570): undefined reference to `google::protobuf::MessageLite::SerializeToString(std::basic_string<char, std::char_traits<char>, std::allocator<char> >*) const'
udp_client.cpp:(.text+0x6f7): undefined reference to `test::Tube_Info::~Tube_Info()'
collect2: ld returned 1 exit status
POurtant mes fichiers sont tous la (un ls me donne):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
log_error  protocol.pb.cc  protocol.pb.h  protocol.proto  udp_client.cpp
Contenu de mes fichiers
udp_client.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
//============================================================================
// Name        : udp_client.cpp
// Author      : Lange Olivier
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include "protocol.pb.h"
#include <string>
#include <cstring>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
 
 
#define MAX_LINE 100
// 3 caractères pour les codes ASCII 'cr', 'lf' et '\0'
#define LINE_ARRAY_SIZE (MAX_LINE+3)
 
#define CLIENT_PORT 9096
#define CLIENT_IP "172.20.1.130"
#define SERVER_PORT 9096
#define SERVER_IP "172.20.1.103"
 
using namespace std;
 
int binToHexa (string data){
 
        string returnData;
          char *a=new char[data.size()+1];
          a[data.size()]=0;
          memcpy(a,data.c_str(),data.size());
 
          int j = data.size();
          for (int i=0; i<j; i++)
                  printf("%x ", a[i]);
 
          return 0;
}
 
int Sock_SetBlockMode (int sock, bool blocking)
{
   int flags;
   int r;
 
   flags = fcntl (sock, F_GETFL);
 
   if (blocking == true)
      r = fcntl (sock, F_SETFL, flags & ~O_NONBLOCK);
   else
      r = fcntl (sock, F_SETFL, flags | O_NONBLOCK);
 
   return r;
}
 
 
int main()
{
 
        //GOOGLE_PROTOBUF_VERIFY_VERSION;
 
        //test::Error_Info test_msg;
        test::Tube_Info test_msg;
/*
        test_msg.set_from(1);
        test_msg.set_to(2);
        test_msg.set_msg("toto");
"udp_client.cpp" 178L, 4066C                                                     
[...]
Une idée de ce qui manque???

Merci.
Onet