Hello,

Passant d'Eclipse à g++ (marre de ce gui qui plante 12 fois apr jour... Vive la ligne de commande...), je me retrouve enquiquiner à ne pas réussir à recomplier mon programme.

Celui-ci utilise 2 class et 1 définition de structure externe. Comment je dois m'y prendre pour compiler tout ca?

Mon fichier principal (me sert a effectuer des tests, avant tout... C'est surtout pour le principe...):
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
#include <iostream>
using namespace std;
 
#include "../include/Communication.h"
#include "../include/structure.cpp"
#include "../include/Log.h"
 
int main() {
        msg test1, test2, test3, test4;
 
        test1.cmd_id = 5;
        test1.lenght = 5;
        test1.urgent = true;
 
        test2.cmd_id = 22;
        test2.lenght = 12;
        test2.urgent = true;
 
        Communication arm_com;
 
        arm_com.send_message ( &test1 );
        arm_com.send_message ( &test2 );
 
 
        arm_com.get_msg(&test3);
        printf("%i", test3.cmd_id);
        arm_com.get_msg(&test4);
        printf("%i", test4.cmd_id);
 
        Log::write_log("Common", 1, "Test");
 
        return 0;
}
Le contenu de mon répertoire include:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
Communication.cpp  
Communication.h  
Communication.o  
Log.cpp  
Log.h  
Log.o  
Queue.cpp  
Queue.h    
Queue.o  
define.h  
structure.h
J'ai bien créer mes .o, mais j'ai du le faire à partir des .cpp, donc à priori ca doit etre fait? Dois-je réellement travailler de cette facon?

Qu'est-ce que je fais de faux?

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
g++ -o common common.cpp ../include/Communication.o ../include/structure.o ../include/Log.o
../include/Communication.o: In function `Communication::send_message(msg*)':
Communication.cpp:(.text+0x98): undefined reference to `Queue::send_msg(msg*)'
Communication.cpp:(.text+0xb7): undefined reference to `Queue::send_msg(msg*)'
../include/Communication.o: In function `Communication::get_msg(msg*)':
Communication.cpp:(.text+0x1cd): undefined reference to `Queue::get_nbr_msg()'
Communication.cpp:(.text+0x218): undefined reference to `Queue::get_msg(msg*)'
Communication.cpp:(.text+0x22c): undefined reference to `Queue::get_nbr_msg()'
Communication.cpp:(.text+0x24a): undefined reference to `Queue::get_msg(msg*)'
../include/Communication.o: In function `Communication::~Communication()':
Communication.cpp:(.text+0x281): undefined reference to `Queue::~Queue()'
Communication.cpp:(.text+0x295): undefined reference to `Queue::~Queue()'
Communication.cpp:(.text+0x2bc): undefined reference to `Queue::~Queue()'
../include/Communication.o: In function `Communication::~Communication()':
Communication.cpp:(.text+0x2ff): undefined reference to `Queue::~Queue()'
Communication.cpp:(.text+0x313): undefined reference to `Queue::~Queue()'
../include/Communication.o:Communication.cpp:(.text+0x33a): more undefined references to `Queue::~Queue()' follow
../include/Communication.o: In function `Communication::Communication()':
Communication.cpp:(.text+0x3f9): undefined reference to `Queue::Queue()'
Communication.cpp:(.text+0x409): undefined reference to `Queue::Queue()'
Communication.cpp:(.text+0x421): undefined reference to `Queue::~Queue()'
../include/Communication.o: In function `Communication::Communication()':
Communication.cpp:(.text+0x457): undefined reference to `Queue::Queue()'
Communication.cpp:(.text+0x467): undefined reference to `Queue::Queue()'
Communication.cpp:(.text+0x47f): undefined reference to `Queue::~Queue()'
collect2: ld returned 1 exit status
merci...
Onet