Code compiles and runs on Visual Studio but not g++

Please edit your code and put [code] code tags [/code] around your code.

So it compiles on both VS and g++, but "doesn't run" on g++.

Please clarify what you mean by "doesn't run". If your OS gets an error while trying to run the EXE, then there's something wrong with your copy of g++, or the EXE is being corrupted. Do you get an error? How are you trying to run it?

My crystal balls thinks that it's a problem with opening your file, though.
Add this:

1
2
3
4
5
6
7
// ...
file.open("vehiclein.txt");
if (!file) { 
    for (int i = 0; i < 1000; i++)
        std::cout << "ERROR CANNOT OPEN FILE" << std::endl;
}
// ... 


Make sure your file is in the same directory you run the executable from.
Last edited on
sorry but, is this a question or answer to no question?
Haha, it was deleted. That's super strange. Someone must have reported the first post to remove it, because I don't think the OP is allowed to remove their own post. Or maybe they can? Whatever, not gonna worry too much about it.
closed account (E0p9LyTq)
This is an answer to several deleted posts, the OP went back and replaced the question and replies with "------". I saw the now deleted posts before they were thrown into the bit bucket.

I guess someone doesn't like people thinking this is their own site to get free private tutoring.
Topic archived. No new replies allowed.