#4 When I compile source package, I got error messages.

closed
nobody
None
5
2009-02-01
2009-02-01
Hyon Lim
No

This is error message.

--------------------Configuration: MFile - Win32 Debug--------------------
Compiling...
test.cpp
D:\kalman-1.3\kalman\SAMPLES\MFILE\test.cpp(27) : error C2893: Failed to specialize function template 'int __thiscall Kalman::MFile::get(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Kalman::KVector<T,BEG,DBG> &)'
With the following template arguments: 'double'

D:\kalman-1.3\kalman\SAMPLES\MFILE\test.cpp(29) : error C2893: Failed to specialize function template 'int __thiscall Kalman::MFile::get(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Kalman::KMatrix<T,BEG,DBG> &)'
With the following template arguments: 'double'

D:\kalman-1.3\kalman\SAMPLES\MFILE\test.cpp(29) : error C2784: 'int __thiscall Kalman::MFile::get(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Kalman::KVector<T,BEG,DBG> &)' : could not deduce templat
e argument for 'class Kalman::KVector<T,BEG,DBG> &' from 'class Kalman::KMatrix<double,1,1>'
D:\kalman-1.3\kalman\SAMPLES\MFILE\test.cpp(52) : error C2893: Failed to specialize function template 'int __thiscall Kalman::MFile::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Kalman::KVector<T,
BEG,DBG> &,int)'
With the following template arguments:
'double'
D:\kalman-1.3\kalman\SAMPLES\MFILE\test.cpp(54) : error C2893: Failed to specialize function template 'int __thiscall Kalman::MFile::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Kalman::KVector<T,
BEG,DBG> &,int)'
With the following template arguments:
'double'
D:\kalman-1.3\kalman\SAMPLES\MFILE\test.cpp(56) : error C2893: Failed to specialize function template 'int __thiscall Kalman::MFile::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Kalman::KMatrix<T,
BEG,DBG> &)'
With the following template arguments:
'double'
D:\kalman-1.3\kalman\SAMPLES\MFILE\test.cpp(56) : error C2784: 'int __thiscall Kalman::MFile::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class Kalman::KVector<T,BEG,DBG> &,int)' : could not deduce tem
plate argument for 'class Kalman::KVector<T,BEG,DBG> &' from 'class Kalman::KMatrix<double,1,1>'
Error executing cl.exe.

MFile.exe - 7 error(s), 0 warning(s)

Discussion

  • Vincent Zalzal
    Vincent Zalzal
    2009-02-01

    From a personal email, you told me you are using Microsoft Visual Studio 2005 Service Pack 1. I just downloaded a fresh copy of kalman-1.3, and tried to compile the MFile sample using Microsoft Visual C++ Express Edition (not sure I have SP1 though) and it worked fine.

    First note: the MFile project is not essential. It is only a demonstration of how to read/write data in matlab format.

    Second note: someone already sent me the exact same messages you just reported, but he was using Microsoft Visual C++ 6.0, and I reproduced the compiler bug at that time. Here was my answer, hoping it will help you too.

    ---

    I finally got hand on VC++ 6.0. That version always gave me problems because of its broken support for C++ templates, and this is another case for it. I don't know why, but it seems the compiler does not support having the definition of a template member function outside of its class definition. To be able to compile the MFile project, you must take all the code that is inside the MFile_impl.hpp and put it back inside the MFile class definition (under the already present prototypes of functions get() and add(), 4 functions in total), in MFile.h. If you so wish, you can remove the file MFile_impl.hpp altogether afterwards.

    I suggest you upgrade your compiler if you can. VC++ 6.0 is getting quite old, and its support for templates is deficient. You can download for free the newest C++ compiler from the Microsoft website, Visual C++ 2008 Express Edition, which should work just fine. I myself use Visual C++ 2005 Express Edition (free) on my home computer, and it works very well.

    Thanks for reporting this bug to me. I hope you will be able to use kfilter in your project and that it will help you. Cheers.

     
  • Vincent Zalzal
    Vincent Zalzal
    2009-02-01

    • status: open --> closed