Re: Compiling LibreCad-2.2.0.alpha on Windows 10 with Qt 4.4.1

Posted by qium06 on
URL: https://forum.librecad.org/Compiling-LibreCad-2-2-0-alpha-on-Windows-10-with-Qt-4-4-1-tp5715344p5715506.html

Hello,
I find out that what causes all these errors is the conversion problem between "std::string" and "std::wstring". Maybe there are ways to set the complier to solve the problem but I don't know how to. I make a few changes to the source code involving two files and the compilation is successful.

In the file  \LibreCAD\librecad\src\lib\math\rs_math.cpp:
rs_math.cpp
Line:305
p.DefineConst(L"pi",M_PI); //   <--  p.DefineConst("pi",M_PI);
Line:306
p.SetExpr(expr_copy.toStdWString());  //   <--p.SetExpr(expr_copy.toStdString())
Line:312
std::cout << QString::fromStdWString(e.GetMsg()).toStdString() << std::endl;  // <-- std::cout << e.GetMsg() << std::endl;

In the file   \libreCAD\plugins\plotequation\plot.cpp:
Line:60~64
p.DefineConst(L"pi",M_PI);                   //<-- p.DefineConst("pi",M_PI);
p.DefineConst(L"e",M_E);                     //<-- p.DefineConst("e",M_E);
p.DefineVar(L"x", &equationVariable);        //<-- p.DefineVar("x", &equationVariable);
p.DefineVar(L"t", &equationVariable);        //<-- p.DefineVar("t", &equationVariable);
p.SetExpr(startValue.toStdWString());        //<-- p.SetExpr(startValue.toStdString());
Line:67
p.SetExpr(endValue.toStdWString());   //<-- p.SetExpr(endValue.toStdString());
Line:70
p.SetExpr(equation1.toStdWString());  //<-- p.SetExpr(equation1.toStdString());
Line:80
p.SetExpr(equation2.toStdWString());  //<-- p.SetExpr(equation2.toStdString());
Line:90
std::cout << QString::fromStdWString(e.GetMsg()).toStdString() << std::endl;  //<-- std::cout <<e.GetMsg() << std::endl;