How to change the line number that is displayed when an error occurs during compilation in C++

1 Answer

0 votes
#include <iostream>

int main() {
    std::cout << "c++" << "\n";
    std::cout << __LINE__ << "\n";
#line 9 
    std::cout << __LINE__ << "\n";
}



/*
run:

c++
5
9

*/

 



answered Dec 3, 2022 by avibootz

Related questions

...