Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solucionado] No puedo compilar programas en C++
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Spanish
View previous topic :: View next topic  
Author Message
Fitap
Guru
Guru


Joined: 13 Mar 2011
Posts: 456
Location: Rosario, Argentina

PostPosted: Sat Jul 13, 2019 11:50 pm    Post subject: [Solucionado] No puedo compilar programas en C++ Reply with quote

Hola foro!

Bueno estaba retomando el aprendizaje C++ y me encuentro que no puedo compilar ningun programa C++

Por ejemplo esta es la salida de un simple holamundo.cpp

Code:

/* "Hola mundo" escrito en C++ */

#include "iostream"

using namespace std;

int main()

{
     cout << "Hola mundo";
     return 0;
}


Code:


gcc holamundo.cpp

/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccGKlPkH.o: warning: relocation against `_ZSt4cout' in read-only section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccGKlPkH.o: en la función `main':
holamundo.cpp:(.text+0xe): referencia a `std::cout' sin definir
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: holamundo.cpp:(.text+0x13): referencia a `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' sin definir
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccGKlPkH.o: en la función `__static_initialization_and_destruction_0(int, int)':
holamundo.cpp:(.text+0x43): referencia a `std::ios_base::Init::Init()' sin definir
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: holamundo.cpp:(.text+0x58): referencia a `std::ios_base::Init::~Init()' sin definir
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object
collect2: error: ld devolvió el estado de salida 1



Nose que ha pasado.
Donde deberia chequear ?
Saludos.


Last edited by Fitap on Sun Jul 14, 2019 7:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
quilosaq
Veteran
Veteran


Joined: 22 Dec 2009
Posts: 1562

PostPosted: Sun Jul 14, 2019 10:18 am    Post subject: Reply with quote

Para código c++ usa g++ en lugar de gcc:
Code:
g++ holamundo.cpp
Back to top
View user's profile Send private message
Fitap
Guru
Guru


Joined: 13 Mar 2011
Posts: 456
Location: Rosario, Argentina

PostPosted: Sun Jul 14, 2019 7:00 pm    Post subject: Reply with quote

Muchas gracias quilosaq por responder.

Saludos.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Spanish All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum