C++- error C2144 syntax error : 'int' should be preceded by ';'
First, the code you have posted begins with a stray backtick. If that's really in your code, you should remove it.
Second, the compiler would be happier, and emit fewer warnings, if you ended your function with the line
return 0; // unreachable
This is good C++ style and is recommended. (In your case, the line may actually be reachable, in which case the line is not only good style but necessary for correct operation. Check this.)
Otherwise, your code looks all right except for some small objections one could raise regarding the outdated, C-style use of #define
and regarding one or two other minor points of style. Regarding the #define
, it is not C++ source code as such but is a preprocessor directive. It is actually handled by a different program than the compiler, and is removed and replaced by proper C++ code before the compiler sees it. The preprocessor is not interested in semicolons. This is why the #define
line does not end in a semicolon. Neither do other lines that begin #
usually end in semicolons.
As @JoachimIsaksson has noted, a needed semicolon may be missing from the end of the file general_configuration.h
or the file helper_function.h
. You should check the last line in each file.
I encounted this issue. I wrote a header file, but I forgot to add ";" at the tail of a function declaration. So, there is a error in my c file which is include this header file. I add comment here, and hope it will be useful for someone.