Menu

Help -- It++ in windows

wavestar
2008-02-28
2012-09-15
  • wavestar

    wavestar - 2008-02-28

    Hi, I have succeed compile the it++ in window. I comiled it in viusal C++ express.
    Now I try to test the itpp.lib -- the libary file in visual C++ 6.0.
    I have set the lib, include directory.
    My test cpp file is :

    include <itpp/itcomm.h>

    using namespace std;
    using namespace itpp;

    void main()
    {

    ivec a(&quot;0 0.7 5 9.3&quot;);
    
    int b = a(5);
    

    }

    comiled error:
    --------------------Configuration: Test - Win32 Debug--------------------
    Compiling...
    test.cpp
    c:\itpp-4.0.1\itpp\base\math\misc.h(102) : error C2995: '<<' : template function has already been defined
    c:\program files\microsoft visual studio\vc98\include\complex(345) : see declaration of '<<'
    c:\itpp-4.0.1\itpp\base\math\misc.h(140) : error C2995: '>>' : template function has already been defined
    c:\program files\microsoft visual studio\vc98\include\complex(326) : see declaration of '>>'
    c:\itpp-4.0.1\itpp\base\mat.h(316) : error C2143: syntax error : missing ';' before '<'
    c:\itpp-4.0.1\itpp\base\mat.h(441) : see reference to class template instantiation 'itpp::Mat<Num_T>' being compiled
    c:\itpp-4.0.1\itpp\base\mat.h(316) : fatal error C1903: unable to recover from previous error(s); stopping compilation
    c:\itpp-4.0.1\itpp\base\mat.h(441) : see reference to class template instantiation 'itpp::Mat<Num_T>' being compiled
    Error executing cl.exe.

    test.obj - 4 error(s), 0 warning(s)


    the function in trouble:
    namespace std {

    //! \cond

    ifndef HAVE_STD_ISINF

    if (HAVE_DECL_ISINF == 1) || defined(HAVE_ISINF)

    inline int isinf(double x) { return ::isinf(x); }

    elif defined(FPCLASS)

    inline int isinf(double x)
    {
    if (::fpclass(a) == FP_NINF) return -1;
    else if (::fpclass(a) == FP_PINF) return 1;
    else return 0;
    }

    else

    inline int isinf(double x)
    {
    if ((x == x) && ((x - x) != 0.0)) return (x < 0.0 ? -1 : 1);
    else return 0;
    }

    endif // #if (HAVE_DECL_ISINF == 1) || defined(HAVE_ISINF)

    define HAVE_STD_ISINF 1

    endif // #ifndef HAVE_STD_ISINF

    ifndef HAVE_STD_ISNAN

    if (HAVE_DECL_ISNAN == 1) || defined(HAVE_ISNAN)

    inline int isnan(double x) { return ::isnan(x); }

    else

    inline int isnan(double x) { return ((x != x) ? 1 : 0); }

    endif // #if (HAVE_DECL_ISNAN == 1) || defined(HAVE_ISNAN)

    define HAVE_STD_ISNAN 1

    endif // #ifndef HAVE_STD_ISNAN

    ifndef HAVE_STD_ISFINITE

    if (HAVE_DECL_ISFINITE == 1) || defined(HAVE_ISFINITE)

    inline int isfinite(double x) { return ::isfinite(x); }

    elif defined(HAVE_FINITE)

    inline int isfinite(double x) { return ::finite(x); }

    else

    inline int isfinite(double x)
    {
    return ((!std::isnan(x) && !std::isinf(x)) ? 1 : 0);
    }

    endif // #if (HAVE_DECL_ISFINITE == 1) || defined(HAVE_ISFINITE)

    define HAVE_STD_ISFINITE 1

    endif // #ifndef HAVE_STD_ISFINITE

    //! \endcond

    //! Output stream operator for complex numbers
    template <class T>
    std::ostream& operator<<(std::ostream &os, const std::complex<T> &x)
    {
    os << x.real();
    ios::fmtflags saved_format = os.setf(ios::showpos);
    os << x.imag();
    os.setf(saved_format, ios::showpos);
    return os << 'i';
    }

    //! Input stream operator for complex numbers
    template <class T>
    std::istream& operator>>(std::istream &is, std::complex<T> &x)
    {
    T re, im;
    char c;
    is >> c;
    if (c == '(') {
    is >> re >> c;
    if (c == ',') {
    is >> im >> c;
    if (c == ')') {
    x = complex<T>(re, im);
    } else {
    is.setstate(ios_base::failbit);
    }
    } else if (c == ')') {
    x = complex<T>(re, T(0));
    } else {
    is.setstate(ios_base::failbit);
    }
    } else {
    is.putback(c);
    is >> re;
    if (!is.eof() && ((c = is.peek()) == '+' || c == '-')) {
    is >> im >> c;
    if (c == 'i') {
    x = complex<T>(re, im);
    } else {
    is.setstate(ios_base::failbit);
    }
    } else {
    x = complex<T>(re, T(0));
    }
    }
    return is;
    }

    } // namespace std

    friend const Mat<Num_T> concat_horizontal <>(const Mat<Num_T> &m1, const Mat<Num_T> &m2);

    Anyone can tell me how to fix it? I have struggle for it several days.

    Thanks a lot,

     
    • Adam Piątyszek

      Adam Piątyszek - 2008-02-29

      Visual C++ 6.0 is not supported for a long time already. Besides, I recommend you to use IT++ with the open-source GCC compilers, preferably on GNU/Linux or any other Unix-like environment.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.