c++ - error: expected constructor, destructor, or type conversion before ‘main’ -
i trying figure out how jump 1 function come , preform another. when compile error
error: expected constructor, destructor, or type conversion before ‘main’
here code:
#include <iostream> #include "32pm.cpp" pm() int main() { std::cout << "hello world!"; }
a function call followed semicolon, statement. statements can used in function body. e.g. in body of main
.
note declarations in c++ come in 2 flavors: block declarations, can used statements in blocks, , non-block declarations, can (directly) used outside functions.
e.g. variable declaration block declaration, , namespace definition (or matter full function definition) non-block declaration.
it's arbitary, essence there divide between constructs can used statements, , cannot, , part of c++ grammar.
Comments
Post a Comment