Can't Get msvc 2013 express to recognize includes

I am coding along in MSVC and I can't seem to get MSVC 2013 express to recognize that HANDMADE_SIM_REGION.CPP and .H...They are included in the solution explorer under source files and header files...They are also #include'd in the proper places...They refuse to actually include...Every time there is a major direction change or a file added I have to get lucky to get MSVC to recognize the files...

Any thoughts on this?

For what its worth, I am obviously not a professional, and I do realize that EMACS or just about anything else is better then MSVC's editor, I just don't want to take the time to learn a new editor.
If you include .cpp file in solution, you don't need to #include it in other file. Casey is doing unity build where he compiles just one .cpp file for game dll. If you put .cpp file in solution then it will be compiled independently and you'll get linking errors because it is also #include'd in different .cpp file.

Please post exact error message, and verify that all files are really on disk where you expect them to be (probably all in same folder).

Edited by Mārtiņš Možeiko on
This is what I get


[attachment=28]2015-03-1801_14_42-Win32_Handmade-MicrosoftVisualStudio.png[/attachment]


The Comical part is everything was fine and then without doing anything most of the includes seemed to stop linking as this screen showed up with everything undefined...All the files are in a Handmade Code folder and they compile to a handmade data folder.

Edited by Jeff on
It is not possible to see the problem, image is too small.
Build the solution, and copy&paste error from compiler/linker.
Its not a specific error...

1>Handmade.cpp(263): error C2039: 'Type' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(279): error C2039: 'Height' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(280): error C2039: 'Width' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(280): error C2039: 'Height' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(281): error C2039: 'Collides' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(288): error C2039: 'HitPoint' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(289): error C2039: 'HitPointMax' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(291): error C2039: 'HitPointMax' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(293): error C2039: 'HitPoint' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(303): error C2039: 'Height' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(304): error C2039: 'Width' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(305): error C2039: 'Collides' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'
1>Handmade.cpp(315): error C2039: 'Height' : is not a member of 'Low_Entity'
1> c:\ms visual studio projects\handmade code folder\handmade.h(70) : see declaration of 'Low_Entity'


Nothing is defined because it wont include Handmade_Sim_Region.cpp and .h...Its like they don't exist...Handmade_Sim_Region.h sees Handmade_platform.H because all the Typedefs are there...This doesn't make any sense.
If it could not include something then error would on line with #include preprocessor directive with message that it can not include. So it includes files just fine.

You are getting these errors because something else is wrong. Have you modified anything in source? What exactly? Nobody can guess that...

Verify that you don't have circular #includes. When A includes B, and B includes A (directly or indirectly - B includes C and then C includes A).

Edited by Mārtiņš Možeiko on
You should exclude the problematic .h files (handmade_entity.h, handmade_sim_region.h etc.) from building. Right click on the file in solution Explorer, under general set excluded from build to yes.
Also there was a thread about compiling with Visual Studio here: https://forums.handmadehero.org/i...?view=topic&catid=4&id=77&start=6 .
Thank you!!!!


JSnake
Hey guys, I'm stuck on week 5. I can follow along using the command line just fine but I prefer to do everything within VS. I just cannot at all figure out how to make handmade.cpp output a dll file. Setting /LD in the VS command line settings doesn't work. Any ideas?

Here's how my project is set up.




Its funny that I read that thread a number of times and the solution is right in the screenshot, but never expressly stated(Or I didn't pick up on it)



Its weird that it just worked until I got to day 64...I can definitely understand Casey's angst towards Mirco$oft...:eek:

Edited by Jeff on
You should exclude the problematic .h files (handmade_entity.h, handmade_sim_region.h etc.) from building
There is no need to do that. Visual Studio builds files only with C and C++ extensions. Header files are not being built unless you explicitly configure that.

I can definitely understand Casey's angst towards Mirco$oft..
I would argue that in this case critics against Microsoft is unfounded. If you do unity build, you need to set up project in Visual Studio correctly. You can not expect it to magically understand how to build your project from all the files, if you actually need to compile just one file.

You can blame C/C++ language and preprocessor, though. Language was made in a way that prevents making easy build systems (like C# or D language has).

Edited by Mārtiņš Možeiko on
Indeed, although I could swear I solved some some problems with building before by setting it like that.
mmozeiko
You should exclude the problematic .h files (handmade_entity.h, handmade_sim_region.h etc.) from building
There is no need to do that. Visual Studio builds files only with C and C++ extensions. Header files are not being built unless you explicitly configure that.