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

1 answer 203 views
1 answer 230 views
2 answers 327 views
1 answer 191 views
1 answer 180 views
1 answer 188 views
...