This question already has answers here:
Can't assign value to vector in c++ [duplicate]
(1 answer)
Does clang on Mac not support uniform initialization?
(1 answer)
How to remove the C++ 11 extension warning in the vsCode
(1 answer)
Closed last month.
While I'm trying to compile my c++ code, I encountered this problem:
warning: 'auto' type specifier is a c++11 extension [-wc++11-extensions]
warning: range-based for loop is a c++11 extension [-wc++11-extensions]
here's my code:
I have tried all solutions on the internet, yet the error message keeps popping up
Related
This question already has an answer here:
checking whether library exist via preprocessor
(1 answer)
Closed 12 months ago.
Windows doesn't seem to support arc4random. Is there a preprocessor macro I can use to identify if arc4random is supported by the platform I'm compiling for ?
https://man.openbsd.org/arc4random.3
The manual says it's from <bsd/stdlib.h>, so...
#if __has_include(<bsd/stdlib.h>)
This question already has answers here:
How to use the <format> header
(3 answers)
Closed 2 years ago.
I want to use the new C++20 <format> header. But when I try to #include it, it apparently doesn't exist in my current stdlib.
I tried using clang++ and g++, but neither of them work.
Yes, I specified the C++ standard to be "c++2a" in the tasks.json file in VSCode.
What am I doing wrong?
You can view an overview of compiler support here: https://en.cppreference.com/w/cpp/compiler_support
According to the table, up to today (May 13 '20 at 8:07) no compiler supports P0645R10: Text formatting.
The overview specifically for MSVS can be found here: https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=vs-2019 (though I didn't find <format> on their list).
This question already has answers here:
xcode library not found
(14 answers)
Adding Linker Flags in Xcode
(3 answers)
Closed 8 years ago.
In terminal, this works:
g++ -lgmp main.cpp
while this does not:
g++ main.cpp
I am using X-code as my IDE and how could I tell X-code to add the statement '-lgmp' when compiling? Thank you:)
Edit: I did according to the article providing the answer:
but I still fail:
and this is the error message:
More information:
I have to use c++98 instead of c++11 because one of my package Gurobi requires that. Do you know any solution? thank you:)
This question already has answers here:
Why does VS not define the alternative tokens for logical operators?
(5 answers)
When were the 'and' and 'or' alternative tokens introduced in C++?
(8 answers)
Closed 8 years ago.
I'm working on a C++ project on Visual Studio 2008 and I found out that and, not and or keywords are not defined.
Am I missing some configuration to enable the use of theses keywords?
AFAIK, they are part of the standard, no?
"Include the header file iso646.h, or compile with the /Za (Disable language extensions) compiler option."
MSDN Link
This question already has an answer here:
Closed 13 years ago.
It seems to me that this function would not be valid since it uses the keyword 'default' as an identifier:
int foo()
{
int default = 42;
return default;
}
However, the Microsoft C++ compiler (versions 14.00.50727.762 and 15.00.30729.0) compile the code without warnings or errors (using the simplest possible command line: 'cl foo.cpp').
Dev-C++ 4.9.9.2 does generate errors when compiling the function.
This seems like such an obvious problem that I must be overlooking something.
Edit: litb dug up the Duplicate for this question Default as a variable name.
MS Visual C++ 6.0 and g++ 4.4.0 produce numerous errors - as they should. I find it hard to believe
that a C++ compiler would accept this - are you sure you really compiled this code?
default is a reserved word, gcc 4.3.2 won't compile that code, not sure what the MS compiler is playing at there!
No, default is a reserved c++ keyword, that's why its failing to compile.