Every time I make a new module and try to link it to my main class (Estudiant.o)
using this line:
g++ -o red1.exe red1.o %OBJETOS_CPP%\Estudiant.o
I get this error:
red1.o:red1.cpp:(.text+0xd): undefined reference to
Estudiant::consultar_DNI() const' red1.o:red1.cpp:(.text+0x18): undefined reference to
Estudiant::Estudiant(int)' red1.o:red1.cpp:(.text+0x25): undefined reference toEstudiant::consultar_nota() const' red1.o:red1.cpp:(.text+0x74): undefined reference to
Estudiant::afegir_nota(double)' red1.o:red1.cpp:(.text+0x83): undefined reference toEstudiant::~Estudiant()' red1.o:red1.cpp:(.text+0xa3): undefined reference to
Estudiant::consultar_nota() const' red1.o:red1.cpp:(.text+0xe5): undefined reference toEstudiant::modificar_nota(double)' red1.o:red1.cpp:(.text+0x10b): undefined reference to
Estudiant::Estudiant()' red1.o:red1.cpp:(.text+0x13a): undefined reference toEstudiant::llegir_estudiant()' red1.o:red1.cpp:(.text+0x144): undefined reference to
Estudiant::te_nota() const' red1.o:red1.cpp:(.text+0x182): undefined reference toEstudiant::escriure_estudiant() const' red1.o:red1.cpp:(.text+0x18c): undefined reference to
Estudiant::~Estudiant()' red1.o:red1.cpp:(.text+0x19f): undefined reference toEstudiant::~Estudiant()' c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: red1.o: bad reloc address 0x0 in section
.ctors' collect2.exe: error: ld returned 1 exit status
And I don't have the original Estudiant.cpp so I thought it might be because different compilers were used for compiling and for the link, but I reinstalled MinGW and I'm still getting this error. I also tried to replace all the files and it didn't work.
Estudiant.o
is recent, so it contains those functions referenced in the error messages? – Some programmer dude