开发者

Created the same Program in Unix and Visual Studio 2010, the Visual Studio one wont compile

We are using Emacs on Sun OS 5.9. I wrote the exact same code in both emacs and visual studio and put them in their own folders on the unix server. The one from emacs compiled without a problem but the one from visual studio wont. I opened the visual studio version in emacs and it looks just like the one i created in emacs but it wont compile. The compiler is g++ Here is the code:

// Samuel LaManna

#include <iostream>

using namespace std;

int main()
{
    cout<<endl;
    cout<<endl;
    cout<<"Hello World!";
    cout<<endl;
开发者_开发问答    cout<<endl;
    return 0:
}

And these are the errors i get when i try to compile the visual studio version:

Intro.cpp: In function int main()': Intro.cpp:14: error: expected;' before ':' token Intro.cpp:14: error: expected primary-expression before ':' token Intro.cpp:14: error: expected `;' before ':' token v245-2%


return 0:

The error is right there.

return 0; with ;


Replace the colon in "return 0:" with a semi-colon "return 0;"


You have 0: as your return value; it should be 0;.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜