PDA

Visualizza la versione completa : [C++] Linking Dev C++ ed errori "undefined reference"


keratox
20-05-2006, 19:07
man.h


class Man{


public: Man(char* nome, int eta):name(nome), age(eta){}
~Man(){ }
void doing();
char* getName(){ return name; };
int getAge(){ return age; };

private:
char * name;
int age;
};


executor.cpp


#include "man.h"
#include <iostream>

using namespace std;

int main(){

Man io("Luca Rossi", 16);

cout << "Età " << io.getAge();

return 0;
}


Compilando executor.cpp mi dà questi errori:


[Linker error] undefined reference to `__w32_sharedptr_initialize'
[Linker error] undefined reference to `_Unwind_SjLj_Register'
[Linker error] ... [molti altri] ...


Non sono molto pratico di c++ e tantomeno di compilatori.

Come risolvo?

oregon
20-05-2006, 19:41
L'ho compilato e tutto e' andato bene ...

Ho usato devcpp 4.9.9.2 ...

keratox
20-05-2006, 19:52
Pensavo di aver sbagliato qualcosa io, per un attimo mi son depresso. :D

Anche io ho la versione 4.9.9.2.

Ecco il log di compilazione, se può servire a qualcosa :dottò: :


Compilatore: Default compiler
Esecuzione di g++.exe...
g++.exe "C:\MyApps\CPlusPlus_Language\18-05-06\executor.cpp" -o "C:\MyApps\CPlusPlus_Language\18-05-06\executor.exe" -I"C:\Programmi\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Programmi\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Programmi\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Programmi\Dev-Cpp\include\c++\3.4.2" -I"C:\Programmi\Dev-Cpp\include" -L"C:\Programmi\Dev-Cpp\lib"
C:/Programmi/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/crtbegin.o(.text+0x5):crtstuff.c: undefined reference to `__w32_sharedptr_initialize'
C:\DOCUME~1\cdc\IMPOST~1\Temp/ccSibaaa.o(.text+0x153):executor.cpp: undefined reference to `_Unwind_SjLj_Register'
C:\DOCUME~1\cdc\IMPOST~1\Temp/ccSibaaa.o(.text+0x1f1):executor.cpp: undefined reference to `_Unwind_SjLj_Resume'
C:\DOCUME~1\cdc\IMPOST~1\Temp/ccSibaaa.o(.text+0x1fc):executor.cpp: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x54):eh_perso nality.cc: undefined reference to `_Unwind_GetTextRelBase'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x62):eh_perso nality.cc: undefined reference to `_Unwind_GetDataRelBase'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x6e):eh_perso nality.cc: undefined reference to `_Unwind_GetRegionStart'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x22a):eh_pers onality.cc: undefined reference to `_Unwind_GetRegionStart'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x461):eh_pers onality.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x4c3):eh_pers onality.cc: undefined reference to `_Unwind_GetLanguageSpecificData'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x516):eh_pers onality.cc: undefined reference to `_Unwind_GetIP'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x5d4):eh_pers onality.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x687):eh_pers onality.cc: undefined reference to `_Unwind_SetGR'

C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x6a0):eh_pers onality.cc: undefined reference to `_Unwind_SetGR'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x6b5):eh_pers onality.cc: undefined reference to `_Unwind_SetIP'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x6c6):eh_pers onality.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x928):eh_pers onality.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0x9a7):eh_pers onality.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(eh_personality.o)(.text+0xa2b):eh_pers onality.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x34):ios_init.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x60):ios_init.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0xc1):ios_init.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x114):ios_init.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x140):ios_init.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x1a1):ios_init.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x1f3):ios_init.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x587):ios_init.cc: undefined reference to `_Unwind_SjLj_Unregister'

C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x5de):ios_init.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x6ab):ios_init.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x6d1):ios_init.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x86d):ios_init.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0x8b3):ios_init.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0xc47):ios_init.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ios_init.o)(.text+0xc9e):ios_init.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSoC1EPSt15basic_streambufIcSt11ch ar_traitsIcEE[std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)]+0x3e):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSoC1EPSt15basic_streambufIcSt11ch ar_traitsIcEE[std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)]+0xb3):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSoC1EPSt15basic_streambufIcSt11ch ar_traitsIcEE[std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)]+0xfa):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSoC2EPSt15basic_streambufIcSt11ch ar_traitsIcEE[std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)]+0x40):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSoC2EPSt15basic_streambufIcSt11ch ar_traitsIcEE[std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)]+0x81):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSoC2EPSt15basic_streambufIcSt11ch ar_traitsIcEE[std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)]+0xa3):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5tellpEv[std::basic_ostream<char, std::char_traits<char> >::tellp()]+0x3d):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5tellpEv[std::basic_ostream<char, std::char_traits<char> >::tellp()]+0xd7):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5tellpEv[std::basic_ostream<char, std::char_traits<char> >::tellp()]+0x119):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'

C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpExSt12_Ios_Seekdir[std::basic_ostream<char, std::char_traits<char> >::seekp(long long, std::_Ios_Seekdir)]+0x3d):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpExSt12_Ios_Seekdir[std::basic_ostream<char, std::char_traits<char> >::seekp(long long, std::_Ios_Seekdir)]+0x6a):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpExSt12_Ios_Seekdir[std::basic_ostream<char, std::char_traits<char> >::seekp(long long, std::_Ios_Seekdir)]+0x13f):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpExSt12_Ios_Seekdir[std::basic_ostream<char, std::char_traits<char> >::seekp(long long, std::_Ios_Seekdir)]+0x17c):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpESt4fposIiE[std::basic_ostream<char, std::char_traits<char> >::seekp(std::fpos<int>)]+0x3f):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpESt4fposIiE[std::basic_ostream<char, std::char_traits<char> >::seekp(std::fpos<int>)]+0x6e):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpESt4fposIiE[std::basic_ostream<char, std::char_traits<char> >::seekp(std::fpos<int>)]+0x158):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5seekpESt4fposIiE[std::basic_ostream<char, std::char_traits<char> >::seekp(std::fpos<int>)]+0x19f):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5flushEv[std::basic_ostream<char, std::char_traits<char> >::flush()]+0x3a):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5flushEv[std::basic_ostream<char, std::char_traits<char> >::flush()]+0x7e):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5flushEv[std::basic_ostream<char, std::char_traits<char> >::flush()]+0xbb):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5flushEv[std::basic_ostream<char, std::char_traits<char> >::flush()]+0xef):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZStlsISt11char_traitsIcEERSt13basic _ostreamIcT_ES5_PKc[std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)]+0x37):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZStlsISt11char_traitsIcEERSt13basic _ostreamIcT_ES5_PKc[std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)]+0x187):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZStlsISt11char_traitsIcEERSt13basic _ostreamIcT_ES5_PKc[std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)]+0x28d):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZStlsISt11char_traitsIcEERSt13basic _ostreamIcT_ES5_c[std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)]+0x3d):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZStlsISt11char_traitsIcEERSt13basic _ostreamIcT_ES5_c[std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)]+0x197):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Unregister'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZStlsISt11char_traitsIcEERSt13basic _ostreamIcT_ES5_c[std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)]+0x238):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Resume'
C:\Programmi\Dev-Cpp\lib/libstdc++.a(ostream-inst.o)(.text$_ZNSo5writeEPKci[std::basic_ostream<char, std::char_traits<char> >::write(char const*, int)]+0x3a):ostream-inst.cc: undefined reference to `_Unwind_SjLj_Register'


[[[[ MI TOCCA SPEZZARE QUI ]]]]

collect2: ld returned 1 exit status

Esecuzione terminata

keratox
21-05-2006, 08:08
Può darsi che ci siano problemi per il fatto che ho un Amd 64 ?

Loading