alebu
Programmer
- Sep 7, 2002
- 46
Hi!
I am using borland c++ compiler 5.5 ( free ).
The sructure of program is very simple: Program.cpp, containing main() function, Array.cpp and Indexed.cpp with my templates.
Those 3 files was succesfully compiled( got Program.obj, Array.obj, Indexed.obj ), but when I trying to link em, I got 'Unresolved external...'. It seems that linker doesn't see classes generated by templates.
Make file is:
-----
CXX = blablabla\bcc32.exe
CXXFLAGS = -5 -O2 -w-par -w-csu -w-aus
DEFINES = -DNDEBUG -DWIN32 -D_WINDOWS
LD = blablabla\bcc32.exe
LDFLAGS = -lap
Program.exe: Program.obj Array.obj Indexed.obj
$(LD) $(LDFLAGS) Program.obj Array.obj Indexed.obj
Program.obj:
$(CXX) -c $(CXXFLAGS) $(DEFINES) Program.cpp
Indexed.obj:
$(CXX) -c $(CXXFLAGS) $(DEFINES) Indexed.cpp
Array.obj:
$(CXX) -c $(CXXFLAGS) $(DEFINES) Array.cpp
-----
But results are:
-----
Error: Unresolved external 'Array<int>::~Array<int>()' referenced from D:\LAB\CP
P\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Array<int>::Array<int>(int)' referenced from D:\LABCPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Indexed<int>::get_min_index() const' referenced from
D:\LAB\CPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Array<int>::set_at(int, int)' referenced from D:\LAB
\CPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Array<int>::get_at(int) const' referenced from D:\LA
B\CPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Indexed<int>::get_max_index() const' referenced from
D:\LAB\CPP\DATALIB\PROGRAM.OBJ
-----
Should I add some options to linker or change something in my sources?
I am using borland c++ compiler 5.5 ( free ).
The sructure of program is very simple: Program.cpp, containing main() function, Array.cpp and Indexed.cpp with my templates.
Those 3 files was succesfully compiled( got Program.obj, Array.obj, Indexed.obj ), but when I trying to link em, I got 'Unresolved external...'. It seems that linker doesn't see classes generated by templates.
Make file is:
-----
CXX = blablabla\bcc32.exe
CXXFLAGS = -5 -O2 -w-par -w-csu -w-aus
DEFINES = -DNDEBUG -DWIN32 -D_WINDOWS
LD = blablabla\bcc32.exe
LDFLAGS = -lap
Program.exe: Program.obj Array.obj Indexed.obj
$(LD) $(LDFLAGS) Program.obj Array.obj Indexed.obj
Program.obj:
$(CXX) -c $(CXXFLAGS) $(DEFINES) Program.cpp
Indexed.obj:
$(CXX) -c $(CXXFLAGS) $(DEFINES) Indexed.cpp
Array.obj:
$(CXX) -c $(CXXFLAGS) $(DEFINES) Array.cpp
-----
But results are:
-----
Error: Unresolved external 'Array<int>::~Array<int>()' referenced from D:\LAB\CP
P\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Array<int>::Array<int>(int)' referenced from D:\LABCPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Indexed<int>::get_min_index() const' referenced from
D:\LAB\CPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Array<int>::set_at(int, int)' referenced from D:\LAB
\CPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Array<int>::get_at(int) const' referenced from D:\LA
B\CPP\DATALIB\PROGRAM.OBJ
Error: Unresolved external 'Indexed<int>::get_max_index() const' referenced from
D:\LAB\CPP\DATALIB\PROGRAM.OBJ
-----
Should I add some options to linker or change something in my sources?