Search code examples
c++functionfunction-declaration

error declaring function C++ - Expected ';' at end of declaration list & Expected ')'


I am attempting to define a function and running into several errors. I am able to define one function successfully like this:

void simulatedFixture(int fixAddress);

however when I attempt to define the next function like this:

void addFixture(bool simShow; int x; int y; int w; int h; int universe; int address; int channelCount);

I encounter the following errors:

Expected ';' at end of declaration list

Expected ')'

Expected member name or ';' after declaration specifiers

I have no idea where I could be going wrong as I feel like I am doing the same thing, just with a few more parameters.

Thanks for help in advance.


Solution

  • Parameters should be separated by comma ,, not by semicolon ;.

    See e.g. here for more details in layman terms:

    https://www.geeksforgeeks.org/functions-in-c/

    https://www.cs.auckland.ac.nz/references/unix/digital/AQTLTBTE/DOCU_056.HTM

    Or here for precise technical reference:

    https://en.cppreference.com/w/cpp/language/function