Executing Linux code in VC

Hi all,

I have a linux based code in C++ which uses G++ for for execution on linux. The authors of the code mention that wiht some changes, it can be compiled on winsows environment too..

also, I found the following code in the source files..

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

which suggest that they did took windows as an option..

But, when I compile it in vc++, it throws many error.. some syntax related..

m not sure if i m doing it the right way.. do I need to make some windows specific changes to the code.. or is basic c++ platform independent..

Many thanks in advance,

Regards,

Abhi
What exactly are the errors?
hey,


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

this is specifically in the code of the file monty.h, which is part of an entire library...

Here is the code:

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..


Here is the code for tht file..
all these functions are taking two arguments... but still the error says doesn't..
is it possible tht error is generating from the code where they are actually called..



#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


the msdn link for this error shows multiple reasons.. but m not sure which one is most close to mine..

http://msdn.microsoft.com/en-us/library/ek13fhc1(VS.80).aspx


It is because you are not passing the correct number of arguments to the functions...check the definitions, it's possible that they could be different on windows.
Topic archived. No new replies allowed.