I had been using g++ compiler (with mingw for win support) for a while as it was my university standard. I had been using the MSVC++ editor since it had better indentation than crimson editor/notepad++, while still using g++ to compile. Recently, I tried to compile a program in VC++ and got a lot of errors, when it worked fine with G++, here is essentially the layout.
My understanding of #include is that it would basically insert the code directly where the #include line was, however, it doesn't seem to work for MSVC++. Am I doing this wrong? is there a setting I missed, or some convention I should be adhering to? Thanks for any help.
I'm not sure what is causing this, but I'm wondering why you are doing './main.h'.
As far as I understand it, includes wrapped in quotes are automatically searched for within the present working directory, so #include "main.h" would have the same effect.
As I said, I'm not entirely sure what causes this, possibly it's because windows uses backslashes for directory structures rather than the forward one used in *nix.
Hopefully one of the experts around here will be able to give you a definitive answer.
Set the compiler flag "-save-temps", and one of the three files that show up should contain the whole code with all the compiler #defines and all the headers in all the #includes.
1) What NwN said. There's no need for the ./, in fact it's probably what is screwing you up.
2) You should never #include cpp files. If you have multiple source files they should all be compiled separately. There are very very few exceptions to this.
3) You are correct to use / for directory seperators and not \. / Works on everything, \ only works on Windows. Stick with /