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 204 views
1 answer 231 views
2 answers 330 views
1 answer 191 views
1 answer 181 views
1 answer 189 views
...