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++)
{
}
}