9

I get the above error message (which I googled and found is something to do with a missing curly brace or something), however, I cannot see where this missing bracket is?

#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) {}
        };

    }
intrigued_66
  • 16,082
  • 51
  • 118
  • 189

4 Answers4

24

In C++, the class keyword requires a semicolon after the closing brace:

class Something {

};  // <-- This semicolon character is missing in your code sample.
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Thanks for that! It now says "fatal error LNK1120: 1 unresolved externals" Im sorry, i'm a Java developer ! – intrigued_66 Apr 02 '12 at 15:02
  • 1
    @user1107474 that means, compiler could find the declaration provided in header file (*.h) but linked could not find the definition. `declaration - int Count();` <---you have this somewhere but missing `definition - int Count() { return 5; }` – Ramadheer Singh Apr 02 '12 at 21:17
6

Your class Something needs to have a terminating semicolon.

class Something{

}; // missing
Konrad
  • 39,751
  • 32
  • 78
  • 114
3

You need a semicolon (;) after the closing brace (}) of the class Something definition

Attila
  • 28,265
  • 3
  • 46
  • 55
2

you might have missed

#ifdef  ROCKSTAR 

#endif <--- this might be missing 
milo2016
  • 21
  • 3