Joseph Mezera
Joseph Mezera

Reputation: 1

'expected primary expression before ')' error'

I am making a game engine and I keep getting an error whenever I compile the project. The compiler spits out this error:

expected primary expression before ')' token.

Can anyone help me with this? I will provide the line with the error below.

if (GameInitialize(HINSTANCE))

Upvotes: 0

Views: 162

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490138

You need to pass a value as the parameter when you call the function. At least in Windows, HINSTANCE is defined as a type (and I doubt anything but Windows uses that name).

Typical use would be in WinMain, which receives the HINSTANCE of the current process as a parameter:

int WinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow) {

    // ...
    if (GameInitialize(hInstance))
        // whatever
}

Note that C++ (like C) is case sensitive, so hInstance and HINSTANCE aren't the same, even though they're equal in a case-insensitive comparison. This is often problematic for people who've used languages (e.g., Pascal) that are normally case-insensitive.

Upvotes: 5

Related Questions