Hi everyone,

I have a library in C++ ( All source and header files) which was targeted for Linux. Although, the authors say that with some minor changes, it can be compiled on Windows too.

Also, when I checked the .CPP files, some do the following code

#ifdef WIN32
#include <windows.h>
#include <wincrypt.h>
#endif

which means.. tht they hav considered windows as an option..

But, when I compile it on VC++, it throws me plenty of error..

what can possibly be the problem.. Any idea?

Regards,

Abhijit

Recommended Answers

All 2 Replies

Hi William,

the following error is repeated for many functions..
error C2660: 'function name' : function does not take 2 arguments

some examples are:

error C2660: 'nres_modadd' : function does not take 2 arguments
error C2660: 'nres_modsub' : function does not take 2 arguments
error C2660: 'nres_modmult' : function does not take 2 arguments
error C2660: 'nres_premult' : function does not take 2 arguments

All errors are from the file, monty.h, which is part of the miracl library used for mathematical calculations.. miracl library provides full support for windows.. so this might not be a syntax error..

I am pasting the header code here..

#ifndef MONTY_H
#define MONTY_H

#include <big.h>

class ZZn 
{ 
    Big fn;
public:
    ZZn()       {  } 
    ZZn(int i)  { if (i==0) fn=0; else fn=nres((Big)i); }
    ZZn(long lg){ if (lg==0L) fn=0; else fn=nres((Big)lg); }
    ZZn(const Big& b) { fn=nres(b); }   /* Big -> ZZn */
    ZZn(big& b)        {copy(b,fn.getbig());}
    ZZn(const ZZn& b) { fn=b.fn; }
    ZZn(char* s){ fn=nres((Big)s); }

    ZZn& operator=(int i) {if (i==0) fn=0; else fn=nres((Big)i); return *this;}
    ZZn& operator=(long lg)
                      {if (lg==0L) fn=0; else fn=nres((Big)lg); return *this;}
    ZZn& operator=(const ZZn& b){fn=b.fn; return *this;}
    ZZn& operator=(char* s){fn=nres((Big)s); return *this;}

    ZZn& operator++() {fn=nres_modadd(fn,nres((Big)1));return *this;}
    ZZn& operator--() {fn=nres_modsub(fn,nres((Big)1));return *this;}
    ZZn& operator+=(int i) {fn=nres_modadd(fn,nres((Big)i));return *this;}
    ZZn& operator+=(const ZZn& b){fn=nres_modadd(fn,b.fn);return *this;}
    ZZn& operator-=(int i) {fn=nres_modsub(fn,nres((Big)i));return *this;}
    ZZn& operator-=(const ZZn& b){fn=nres_modsub(fn,b.fn);return *this;}
    ZZn& operator*=(const ZZn& b) {fn=nres_modmult(fn,b.fn);return *this;}
    ZZn& operator*=(int i) {fn=nres_premult(fn,i);return *this;}

    BOOL iszero() const;
    operator Big() {return redc(fn);}   /* ZZn -> Big */
    friend big getbig(ZZn& z) {return z.fn.getbig();}

    ZZn& operator/=(const ZZn& b) {fn=nres_moddiv(fn,b.fn); return *this;}
    ZZn& operator/=(int i) {fn=nres_moddiv(fn,nres((Big)i));return *this;}

    friend ZZn operator-(const ZZn&);

    friend ZZn operator+(const ZZn&,int);
    friend ZZn operator+(int, const ZZn&);
    friend ZZn operator+(const ZZn&, const ZZn&);

    friend ZZn operator-(const ZZn&, int);
    friend ZZn operator-(int, const ZZn&);
    friend ZZn operator-(const ZZn&, const ZZn&);

    friend ZZn operator*(const ZZn&, int);
    friend ZZn operator*(int, const ZZn&);
    friend ZZn operator*(const ZZn&, const ZZn&);

    friend ZZn operator/(const ZZn&, int);
    friend ZZn operator/(int, const ZZn&);
    friend ZZn operator/(const ZZn&, const ZZn&);

    friend BOOL operator==(const ZZn& b1,const ZZn& b2)
    { if (b1.fn==b2.fn) return TRUE; else return FALSE;}
    friend BOOL operator!=(const ZZn& b1,const ZZn& b2)
    { if (b1.fn!=b2.fn) return TRUE; else return FALSE;}

    friend ZZn  pow( const ZZn&, const Big&);
    friend ZZn  pow( const ZZn&,int);
    friend ZZn  pow( const ZZn&, const Big&, const ZZn&, const Big&);
    friend ZZn  pow( int,ZZn *,Big *);    

    friend ZZn  sqrt(const ZZn&);          // only works if modulus is prime
    friend ZZn  luc( const ZZn&, const Big&, ZZn* b3=NULL);
    ~ZZn() { }
};

#endif

Regards,

Abhi

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.