Scene:
In general, this problem may be that a "}"
is missing
There is also a small probability that your C++standard library is C++98 or earlier, which does not support non built-in initialization list writing.
the Situation of Missing ‘}’
We can see that if our test1 method is short of one}, all subsequent functions will report errors. We need to check it carefully
Solution
Check for yourself that the first line of code near the line number that reports the error is missing a }.
C++ standard does not support
When your C++ standard is C++98, the initialization list of C++98 does not support the initialization list methods of non-built-in types. This can be seen in the following code
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main()
{
int a[] = { 1, 2, 3 };
int b[] {1, 2, 3};
vector<int> v{1,5,5};
map<int, float> m{{1, 2.f}, {2, 3.2f}};
return 0;
}
编译结果:
Solution:
Then in this case your non-built-in type variables will have to be initialized using other methods
Read More:
- Failed to remove multipath map 320b508ca45022b80 [How to Solve]
- Grpc Compilation issues: “C++ versions less than C++11 are not supported.
- [Solved] Leetcode Error: AddressSanitizer: SEGV on unknown address 0x55eb765425b8 (pc 0x55eb76542b86 bp 0x7ffd1bd2
- bazel Compile Error: absl/base/policy_checks.h:79:2: error: #error “C++ versions less than C++14 are not supported.”
- [Solved] error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
- C++ Use of deleted function error
- Visual Studio 2012 error C4996: ‘scanf’: This function or variable may be unsafe.
- Function declare Error: Error C231: ‘delay300us’: redefinition
- [Solved] std::max() error C2589: ‘(‘ : illegal token on right side of ‘::‘
- [Solved] C++ Compile Error: prerequisites are different [How to Solve]
- [Solved] igb Compile Error: igb_main.c:10044:7: error: implicit declaration of function ‘isdigit’
- C++:error C2872: ‘byte‘: ambiguous symbol [How to Solve]
- result = e.symbols[symb] KeyError: b‘system‘ [How to Solve]
- [Solved] Tensorflow2.0 Error: Function call stack:distributed_function
- error: switch `b‘ requires a value [How to Solve]
- Matlab R2019b License Manager Error -103 [How to Solve]
- [Solved] vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: “TypeError: Cannot read property ‘length‘
- this.$el.querySelectorAll is not a function [How to Solve]
- Cmake Setting Support C++11 This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options
- How to Solve Fatal error stdatomic in C/C++ Compilation