I’ve copied and pasted some files from my windows machine to my linux one and ran into a few understandable problems with the conio.h and Windows.h headers, but I can’t remember what they’re needed for.
They’re only in the main function so I commented them out and ran the program again thinking the errors would show me where they’re needed so I could then google what headers would work similarly for linux.
The problem I have is that all the errors I get are in header files I’ve included in the main function, but don’t have the Windows.h or conio.h headers included.
The question I have is how/why: –
Does the compiler look at each header file in turn, get to the windows.h header and stop then when that’s commented out it get’s to my “Chapter_7.h” header and find all the problems in there.
Or could the commenting out of the headers in the main.cpp somehow affect the headers I wrote.
Or (possibly more likely) Is there another option I’ve overlooked?
Thanks for any answers.
It is due to the way
.hfiles are “INCLUDED” in the.cpp. During compilation, all the text in the header files is copy pasted into the including.cppfile. This means later.hfiles will have access to earlier ones.This looks to be what is happening in your case,
windows.hwould have been the first include, and subsequent headers have been using it all along.