所有想法的问题使用ttmath库的编译器(C ++)

时间:2018-12-19 12:25:18

标签: c++ netbeans compiler-errors dev-c++

我创建了一个程序,该程序以质数分解输入的数字。 我尝试首先使用dev c ++进行编译,但它给了我这些错误:

Error: operand type mismatch for `movq`
Error: incorrect register `%edx' used with `q' suffix

Netbeans抛出此消息:

cd 'C:\Users\Frank\Desktop\Riemann\Riemann'
C:\cygwin64\bin\make.exe -f Makefile CONF=Release
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Frank/Desktop/Riemann/Riemann'
"/usr/bin/make"  -f nbproject/Makefile-Release.mk dist/Release/Cygwin_1-Windows/riemann.exe
make[2]: Entering directory '/cygdrive/c/Users/Frank/Desktop/Riemann/Riemann'
make[2]: *** No rule to make target '../../ttmath-0.9.3/ttmath/ttmathuint_x86_64_msvc.asm', needed by 'build/Release/Cygwin_1-Windows/_ext/88761bfc/ttmathuint_x86_64_msvc.o'.  Stop.
make[2]: Leaving directory '/cygdrive/c/Users/Frank/Desktop/Riemann/Riemann'
make[1]: *** [nbproject/Makefile-Release.mk:60: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Frank/Desktop/Riemann/Riemann'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 657ms)

这是我的源文件:

#include "ttmath.h"
#include "sstream"
#include "iostream"
using namespace std;

//Prototipi:
string inttostr(ttmath::Int<1024*1024> toCast);
void FattorNumPrimi(ttmath::Int<1024*1024> n);

int main()
{
    ttmath::Int<1024*1024> n;
    cout<<"Choose your number: ";
    cin>>n; 
    FattorNumPrimi(n);
    cout<<endl;
    system("pause");
    return 0;
}

//Funzioni:
string inttostr(ttmath::Int<1024*1024> toCast)
{
    ostringstream converter;
    converter.seekp(0);
    converter <<toCast;
    return converter.str();
}

void FattorNumPrimi(ttmath::Int<1024*1024> n)
{
    string prec="This is your number's factorization: "+inttostr(1);
    //unsigned long long int i=0;
    //unsigned long long int j=0;
    int x;
        ttmath::Int<1024*1024> h=(1/2);//exponent for the pow function

        for (ttmath::Int<1024*1024> s=2; s<=n; s++)
        { 
           for (ttmath::Int<1024*1024> t=2; t*t<=s; t++)
           { x=0;
               if (s % t == 0)
               {
                   break;
                }else if (t+1 > s.Pow(h)) {

               while(x!=1)
               {   
                   if(n%2==0&&n!=0)//Added because the prime number generation skips 2 and 3
                   {
                      n=n/2;                  
                      prec=prec+" x "+inttostr(2);
                   }else if(n%3==0&&n!=0)//Added because the prime number generation skips 2 and 3
                   {
                      n=n/3;                  
                      prec=prec+" x "+inttostr(3);
                   }else if(n%s==0&&n!=0)//If n can be divided by the prime number
                   {
                      n=n/s;                  
                      prec=prec+" x "+inttostr(s);
                   if(n==s)//If n is equal to the current prime number
                   {
                      prec=prec+" x "+inttostr(n);
                      n=0;
                   }                                  
                   }else
                   {
                     x=1;
                   }     
               }
            }
        }
    }
        cout<<prec;
}

Visual Studio也无法编译。

p.s .:如果我使用unsigned long long int并且不包含ttmath库,则该程序可以工作,但是我需要它处理大量数字。

0 个答案:

没有答案