Bonjour à tous.
Je suis debutante en c++ et je dois programmer une application en C++ sous unix.
J'utilise Kdevelop. j'ai fais un petit programme contenant une seule classe A
la foction main est ecrite dans un autre fichier "test1.cpp"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 class A { public : int f() { return i;} void f(int val ) { i=val;} private : int i; };
pour la compilation j'ai ecris cette commande dans le konsole "gcc test&.cpp -o test1"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 int main() { A a; a.f(10); printf("%d \n",a.f()); return EXIT_SUCCESS; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 /tmp/ccBwG1CL.o: In function `__static_initialization_and_destruction_0(int, int)': test1.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()' /tmp/ccBwG1CL.o: In function `__tcf_0': test1.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()' /tmp/ccBwG1CL.o: In function `main': test1.cpp:(.text+0x8b): undefined reference to `A::A()' test1.cpp:(.text+0xc9): undefined reference to `A::~A()' test1.cpp:(.text+0xdf): undefined reference to `A::~A()' /tmp/ccBwG1CL.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status
Please aidez mois.![]()
Partager