Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Error 42: Symbol Undefined
=========================================== Digital Mars C/C++ Compiler Version 8.40.2n =========================================== DMC has a problem with the following program. ====== C++ code : BEGIN ====== --- File foo.h : BEGIN --- #ifndef _FOO_H #define _FOO_H template <typename T1, typename T2, char T3> T1 Fun(); template <typename T1, typename T2, char T3> struct Bar { T1 data_; Bar() { data_ = Fun<T1, T2, T3>(); } }; #endif --- File foo.h : END ----- --- File foo.cpp : BEGIN --- #include "foo.h" template<> long Fun<long, double, 'a'>() { return 100; } --- File foo.cpp : END ----- --- File foo_main.cpp : BEGIN --- #include "foo.h" int main () { Bar<long, double, 'a'> b; return 0; } --- File foo_main.cpp : END ----- ====== C++ code : END ======== ====== Compilation : BEGIN ====== $ dmc -I. -IC:/dm/stlport/stlport foo_main.cpp foo.cpp foo_main.cpp: foo.cpp: link foo_main+foo,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved foo_main.obj(foo_main) Error 42: Symbol Undefined ??$Fun JN$0GB YAJXZ --- errorlevel 1 ====== Compilation : END ======== -- Alex Vinokur mailto:alexvn connect.to http://mathforum.org/library/view/10978.html Mar 18 2004
Looks to me like you've tried to specialise a function template, and that is not a valid thing to do in C++; not pre-C++05, anyway. "Alex Vinokur" <alexvn connect.to> wrote in message news:c3cpv1$17ob$1 digitaldaemon.com...=========================================== Digital Mars C/C++ Compiler Version 8.40.2n =========================================== DMC has a problem with the following program. ====== C++ code : BEGIN ====== --- File foo.h : BEGIN --- #ifndef _FOO_H #define _FOO_H template <typename T1, typename T2, char T3> T1 Fun(); template <typename T1, typename T2, char T3> struct Bar { T1 data_; Bar() { data_ = Fun<T1, T2, T3>(); } }; #endif --- File foo.h : END ----- --- File foo.cpp : BEGIN --- #include "foo.h" template<> long Fun<long, double, 'a'>() { return 100; } --- File foo.cpp : END ----- --- File foo_main.cpp : BEGIN --- #include "foo.h" int main () { Bar<long, double, 'a'> b; return 0; } --- File foo_main.cpp : END ----- ====== C++ code : END ======== ====== Compilation : BEGIN ====== $ dmc -I. -IC:/dm/stlport/stlport foo_main.cpp foo.cpp foo_main.cpp: foo.cpp: link foo_main+foo,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved foo_main.obj(foo_main) Error 42: Symbol Undefined ??$Fun JN$0GB YAJXZ --- errorlevel 1 ====== Compilation : END ======== -- Alex Vinokur mailto:alexvn connect.to http://mathforum.org/library/view/10978.html Mar 18 2004
"Matthew" <matthew stlsoft.org> wrote in message news:c3cubk$1fbo$1 digitaldaemon.com...Looks to me like you've tried to specialise a function template, and that is not a valid thing to do in C++; not pre-C++05, anyway. Mar 18 2004
"Alex Vinokur" <alexvn connect.to> wrote in message news:c3e0qb$ael$1 digitaldaemon.com..."Matthew" <matthew stlsoft.org> wrote in message news:c3cubk$1fbo$1 digitaldaemon.com...Looks to me like you've tried to specialise a function template, and that is not a valid thing to do in C++; not pre-C++05, anyway. Mar 21 2004
|