Имеются файлы silly.h, silly.cxx, main.cxx следующего содержания:
// file silly.h
using namespace std;
template<class T> void out(const T& t);
// end of file silly.h
// file silly.cxx
#include <iostream> 
#include <string>
#include "silly.h"
export template<class T> void out(const T& t) { cout << "Just the test: \n" << t << "\n"; }
// end of file silly.cxx
// file main.cxx
#include <iostream>
#include <string>
#include "silly.h"
int main()
{
	string test("What a fuck is this?!");
	out<string>(test);
	return 0;
}
// end of file main.cxx
а также есть вот такой простенький Makefile
main: main.o  silly.o
		 g++-3.0 -g  $^ -o $@ 
silly.o: silly.cxx silly.h
		 g++-3.0 -g -c   $< -o $@ 
main.o: main.cxx silly.h
		 g++-3.0  -g -c  $< -o $@ 
И вот что из этого всего выходит:
dselect@pc7235b~/coding/silly $make
g++-3.0  -g -c  main.cxx -o main.o 
g++-3.0 -g -c   silly.cxx -o silly.o 
g++-3.0 -g  main.o silly.o -o main 
main.o: In function `std::allocator<char>::~allocator()':
/usr/include/g++-v3/bits/basic_string.tcc(.text+0x6f): undefined reference to `void out<std::string>(std::string const&)'
collect2: ld returned 1 exit status
make: *** [main] Error 1
Внимание, вопрос: что я делаю неправильно?







    
        Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.
      
Похожие темы
- Форум Function template with a template argument. (2013)
- Форум Помогите упростить шаблонную функцию (2013)
- Форум Шаблоны, почему не работает? (2017)
- Форум boost.asio, boost.serialization (2010)
- Форум Валится на throw (2005)
- Форум Вопрос по шаблонам функций-членов в С++ (2005)
- Форум libdl и обратные ссылки (2017)
- Форум C++: функция с переменным числом аргументов (2022)
- Форум Трабла с template в С++ (2002)
- Форум Такое вообще легально? (2019)