致命错误C1004:发现意外的文件结尾

mez*_*hic 7 c++ visual-c++

我得到上面的错误信息(我用谷歌搜索,发现与缺少大括号或其他东西有关),但是,我看不到这个缺少的括号在哪里?

#include "stdafx.h"
#include <Windows.h>
#include <iostream>
using namespace std;

    class Something{


        static DWORD WINAPI thread_func(LPVOID lpParameter)
        {
            thread_data *td = (thread_data*)lpParameter;
            cout << "thread with id = " << td->m_id << endl;
            return 0;
        }


        int main()
        {
            for (int i=0; i< 10; i++)
            {
                CreateThread(NULL, 0, thread_func, new thread_data(i) , 0, 0);
            }

            int a;

            cin >> a;
        }

        struct thread_data
        {
            int m_id;
            thread_data(int id) : m_id(id) {}
        };

    }
Run Code Online (Sandbox Code Playgroud)

Fré*_*idi 23

在C++中,class关键字在结束括号后需要一个分号:

class Something {

};  // <-- This semicolon character is missing in your code sample.
Run Code Online (Sandbox Code Playgroud)


Kon*_*rad 5

你的班级Something需要一个终止分号.

class Something{

}; // missing
Run Code Online (Sandbox Code Playgroud)