Newbie compiling -> "undefined reference to" error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi here,

compiling  the main.cpp file below i get this error:

tirengarfio@acergarpe:~/Desktop/Examenes/Prueba$ g++ main.cpp -o main
/tmp/ccey9OCP.o: In function `main':
main.cpp:(.text+0x26): undefined reference to `CPrueba::CPrueba(int)'
collect2: ld devolvió el estado de salida 1

These are the files:

/////CPrueba.h////////
class CPrueba

{
private:
int num;

public:
CPrueba(int numero);

};


/////CPrueba.cpp//////

#include "CPrueba.h"

int CPrueba::CPrueba(int numero)
{
num=numero;

}

/////main.cpp/////

#include "CPrueba.h"

int main()
{

int d=8;

CPrueba obj(d);

}


-- 
View this message in context: http://www.nabble.com/Newbie-compiling--%3E-%22undefined-reference-to%22-error-tf4242386.html#a12071723
Sent from the gcc - Help mailing list archive at Nabble.com.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux