This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Newbie compiling -> "undefined reference to" error


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]