简体   繁体   中英

syntax error : missing ';' before 'type'

I'm working with OPNET modeler and I inject code to improve my scenario. when I compile code this message appeared syntax error : missing ';' before 'type' but it refer to transition that don't have any line of code.

What's the problem?

please, Can anyone help me?

That error message indicates that you have a missing semicolon. The most common place this happens is something like the following:

class Foo {

    // ...

} // <-- NEED SEMICOLON HERE

int main() {
   // ...
}

Note that your class declaration may appear in a header file instead of a .cpp file.

This error can also occur for some strict compilers if you declare and assign a variable in the same breath. This can be solved by changing foo_t my_var = old_var; and splitting up the statement into

foo_t my_var;
my_var = old_var;

Ludicrously, some compilers even throw an error if you don't put your variable declarations at the top of the code block.[1]

[1] http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/974f1b6a-7bad-4be7-a93e-66e6b2f18842

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM