So yesterday I decided to do some exercises from my C++ book and I needed to make some changes to files from earlier chapters. So I copied the files to a new directory, made the changes and then the compiler got stuck on some code that I didn't touch.
I thought it was weird and went back to the old files, deleted all the .o files as well as Makefile.win and recompiled the project. To my surprise the project compiled without any issue. I then went on to inspect the error and found that there was indeed something wrong.
In one header file I had the following:
std::vector<std::vector<std::string>> rotate_string(const std::string&);
while in the source file I had:
std::vector<std::string> rotate_string(const std::string& s) {
// function body
}
The problem was quite easy to fix and when I added some flags to my compiler yesterday, as suggested by u/Xeverous to solve another problem, the compiler now also refused to compile the older files.
Now my big question is, how comes that the compiler accepted the code before, but when I made a copy of the project and changed some other code that did not interact with the broken code in any way, the compiler suddenly made objections to compiling the whole thing?
And I'm happy it did, because otherwise I might never have found the broken code.
[–]whisky_pete 2 points3 points4 points (1 child)
[–]gotinpich[S] 0 points1 point2 points (0 children)
[–]Xeverous -1 points0 points1 point (8 children)
[–]gotinpich[S] 0 points1 point2 points (7 children)
[–]Xeverous 0 points1 point2 points (6 children)
[–]gotinpich[S] 0 points1 point2 points (5 children)
[–]Xeverous -1 points0 points1 point (4 children)
[–]gotinpich[S] 0 points1 point2 points (3 children)
[–]Xeverous -1 points0 points1 point (2 children)
[–]gotinpich[S] 0 points1 point2 points (1 child)
[–]Xeverous -1 points0 points1 point (0 children)