Problem overview
Today, when learning the vector container, I found that clion threw such an error, as shown in the following figure
this problem still exists after compiling with clang
~/Documents/Clion_Project/Learning/L11.cpp:12:1: error: expected unqualified-id
for (int i = 0; i < v.size(); i++)
^
1 error generated.
reason:
The main function is not written
Solution:
#include <vector>
using namespace std;
int main()
{
struct Vertex
{
int a;
float b;
};
vector<Vertex> v;
for (int i = 0; i < v.size(); i++)
{
}
}
Read More:
- [Error] expected unqualified-id before ‘delete‘
- [Solved] C++ Compile Error: prerequisites are different [How to Solve]
- [Solved] C++ Compile: error LNK2019: unresolved external “XX“
- bazel Compile Error: absl/base/policy_checks.h:79:2: error: #error “C++ versions less than C++14 are not supported.”
- [Solved] Keil C Error: error C141: syntax error near ‘=‘, expected ‘__asm‘
- [Solved] fatal error C1189: #error: STL1003: Unexpected compiler, expected C++ compiler
- C++ Compile Error: error: invalid conversion from ‘void*‘ to ‘char*‘ [-fpermissive]
- [Solved] C + + compile Error: error: default argument given for parameter 3
- error: expected ‘;‘ at end of member declaration and expected ‘)‘ before ‘&‘ toke Errors
- [Solved] Software Compile Error: xdo.c:29:34: fatal error: X11/extensions/XTest.h:
- [Solved] igb Compile Error: igb_main.c:10044:7: error: implicit declaration of function ‘isdigit’
- C++:error C2872: ‘byte‘: ambiguous symbol [How to Solve]
- How to Solve Hdsc32 MDK compile error: #29 & #223-D
- How to Solve Fatal error stdatomic in C/C++ Compilation
- Grpc Compilation issues: “C++ versions less than C++11 are not supported.
- Keil5 error: #29: expected an expression [Solved]
- [Solved] URIError: Failed to decode param ‘/%3C%=%20BASE_URL%20%3Estatic/index.%3C%=%20VUE_APP_INDEX_CSS_HASH%20%3E.css’
- [Solved] xacro: error: expected exactly one input file as argument
- Cannot start container 39f96c64a9c6: [8] System error: exec format error
- [Solved] Error: error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function