Axonn
Axonn

Reputation: 10336

Visual C++ Error C2143: syntax error : missing ';' before 'constant'

While the error is identical to what others have experienced, my surroundings are completely different. I actually do try to declare a constant:

const long CS_DROPSHADOW = 0x20000;
const long WS_EX_LAYERED = 0x80000;

The error is reported for the two constant names.

The constants declaration is located in a Header file, outside any class declaration.

Here is how the H file looks like:

#ifndef _ASD_SMARTWINDOW_MAIN_H_TAGXXXMAIH_
#define _ASD_SMARTWINDOW_MAIN_H_TAGXXXMAIH_

#include "ASDTail.h" //Queue support.

namespace ASDSmartWindowMaster
{
...
};

class ASDSmartWindowListener
{
};

const long CS_DROPSHADOW = 0x20000;
const long WS_EX_LAYERED = 0x80000;

//Now comes a bunch of enums...
enum KLayeredWindowType
{ ... };


class ASDSmartWindow
{
};

#endif

Upvotes: 0

Views: 7314

Answers (1)

Igor Chornous
Igor Chornous

Reputation: 1068

CS_DROPSHADOW and WS_EX_LAYERED are declared in WinUser.h. Verify that you didn't include it before your declarations.

Upvotes: 2

Related Questions