求解内置宏C/C++_LIN_(gcc/g++)

#include
using namespace std;
void main()
{

cout<<_LINE_<<endl;
}

error: ‘_LINE_’ was not declared in this scope
std::cout<<_LINE_<<std::endl;

试试 LINE
前后的下划线都是两个。

这个宏是用于调试的时候打印代码的在源文件的行数的,应该是“__LINE__”

#include<iostream>
using namespace std;
int main()
{   
    cout<<__LINE__<<endl;
} 

http://codepad.org/ABKlDLpZ
输出 6