Search code examples
c++program-entry-point

int_main()_error_'::main' must return 'int'


#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
    cout<<"Just work";

    return 0;
}

i dont why it is giving the error '::main' must return 'int' I am giving the return type and value IDE: Eclipde Mars


Solution

  • There is no error in your code. The return type of your main is int as it should be.

    The static analyzer of eclipse cdt is not very good at parsing c++. If you don't like reading false positive error messages, then you should disable it.