How can a program with a global variable called main instead of a main function work?

前端 未结 7 1479
长情又很酷
长情又很酷 2020-12-07 12:05

Consider following program:

#include 
int main = ( std::cout << \"C++ is excellent!\\n\", 195 ); 

Using g++ 4.8.1 (mi

相关标签:
7条回答
  • 2020-12-07 12:50

    I've tried this on a Win7 64bit OS using VS2013 and it compiles correctly but when I try to build the application I get this message from the output window.

    1>------ Build started: Project: tempTest, Configuration: Debug Win32 ------
    1>LINK : fatal error LNK1561: entry point must be defined
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    
    0 讨论(0)
提交回复
热议问题