-
Notifications
You must be signed in to change notification settings - Fork 243
Description
Issue Description
I am encountering an issue when trying to use std::cout in various C++ programs compiled using Visual Studio 2022 on Windows 11. Whenever I attempt to use the << operator with std::cout to print a variable, I get the following errors during compilation:
Error (active) E0349: No operator "<<" matches these operands
Error C2678: Binary "<<" : no operator found which takes a left-hand operand of type "std::basic_ostream<char,std::char_traits>" (or there is no acceptable conversion)
This error appears in multiple programs, not just when using the Big type from the MIRACL library.
Example Code
Here is one of the example programs where the issue occurs. The code is meant to calculate the factorial of a number using MIRACL's Big type:
extern "C"
{
#include <miracl.h>
}
#include <big.h>
#include
using namespace std;
Miracl precision(500, 10); // This makes sure that MIRACL is initialised before main() is called
int main()
{
Big nf = 1; // declare "Big" variable nf
int n;
cout << "factorial program\n";
cout << "input number n= \n";
cin >> n;
while (n > 1)
nf *= (n--); // nf=n!=n*(n-1)*(n-2)*....3*2*1
cout << "n!= \n" << nf << "\n"; // This line causes the error
}
However, I've also encountered the same error in simpler programs that don't involve the Big type. It appears that Visual Studio 2022 is struggling to find a valid overload for the << operator in these cases.
System Information
Operating System: Windows 11
Development Environment: Visual Studio 2022