C++ vs C headers? Visual Studio


Questions, Explanations, Howtos

Dungeon Dilettante

Posts: 4

Joined: Thursday, 18th February 2021, 05:11

Post Monday, 8th March 2021, 16:30

C++ vs C headers? Visual Studio

There is an MSVC folder in source that contains a Visual Studio project for crawl, presumably for doing Windows development and builds. When I open it, Visual Studio complains about dozens of missing header files.

What is curious is the missing headers are mostly all the standard C header files. e.g.:

#include <stddef.h>
#include <string.h>

The C++ version of those files would normally be:

#include <cstddef>
#include <cstring>

Just wondering if any devs have insight on how this could be handled to bring the MSVC project back to the state where it could compile but without breaking crawl for the rest of the developers?

Abyss Ambulator

Posts: 1131

Joined: Tuesday, 4th January 2011, 15:03

Post Monday, 8th March 2021, 21:14

Re: C++ vs C headers? Visual Studio

I think you are mistaken. C++ supports stddef.h etc., they are in the C++ standard. The cstdef version just puts the names in the std namespace, while the stddef.h puts names in the global namespace.

You may tell us your visual studio and windows version, and maybe somebody could tell you where the C headers are installed. (Or maybe they are installed separately, I do not know.) Then you can add that path to your MSVC project's "additional include directories" or whatever it is called. For example, I found this blogpost on the location of such headers in newer MSVCs:

https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/

Dungeon Dilettante

Posts: 4

Joined: Thursday, 18th February 2021, 05:11

Post Wednesday, 10th March 2021, 23:48

Re: C++ vs C headers? Visual Studio

Thank you. I'm not a C or C++ developer and you are correct, I just re-targeted the project to the current version of Visual Studio (2019) and most of those errors went away. I now have the below list of missing files which as far as I can tell are not included in git, but are auto-generated. Looking at a Linux build those files exist but have "This file is automatically generated." comments. How do I get these files to generate in visual Studio? I tried just "build" but that didn't work.

(apologies for the formatting)

Severity Code Description Project File Line
Error (active) E1696 cannot open source file "art-enum.h" crawl ability.cc 20
Error (active) E1696 cannot open source file "rltiles/tiledef-icons.h" crawl ability.cc 60
Error (active) E1696 cannot open source file "lua.h" crawl clua.h 4
Error (active) E1696 cannot open source file "lauxlib.h" crawl clua.h 5
Error (active) E1696 cannot open source file "lualib.h" crawl clua.h 6
Error (active) E1696 cannot open source file "species-type.h" crawl newgame-def.h 9
Error (active) E1696 cannot open source file "zlib.h" crawl package.h 10
Error (active) E1696 cannot open source file "species-type.h" crawl species.h 12
Error (active) E1696 cannot open source file "sqlite3.h" crawl sqldbm.h 16
Error (active) E1696 cannot open source file "config.h" crawl stringutil.h 10
Error (active) E1696 cannot open source file "species-type.h" crawl tilepick.h 14
Error (active) E1696 cannot open source file "rltiles/tiledef-gui.h" crawl ui.h 14

Return to Coding

Who is online

Users browsing this forum: No registered users and 4 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.