scons icon indicating copy to clipboard operation
scons copied to clipboard

Standard C++ header names may conflict with target names

Open mwichmann opened this issue 2 years ago • 0 comments

The C++ standard defines a number of headers which do not have filename suffixes. This seems to cause problems when the scanner detects usage of such a header and a target has the same name. For reference, here's an informal listing: https://en.cppreference.com/w/cpp/header

A very simple example (similar to one in the email thread) shows this:

#include <map>

int main(int, char **) { }

SConstruct:

Program("map", "map.cc")

Results:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: done building targets.

scons: *** Found dependency cycle(s):
  map -> map.o -> map

File "/home/mats/github/scons/SCons/Taskmaster/__init__.py", line 1128, in cleanup

Since <map> is not in the build directory (on this particular system, it lives in /usr/include/c++/13/debug/map) this shouldn't be any conflict, but I'm guessing we don't know that in the place it's being looked at. At the very least, docs need to provide some guidance about this case.

  • scons-users mailing list thread: https://pairlist4.pair.net/pipermail/scons-users/2023-September/009213.html

mwichmann avatar Sep 15 '23 00:09 mwichmann