Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
99 views
in Technique[技术] by (71.8m points)

What is a headermap in C or C++ or Objective-C

I was just trying to use Xcode to work on a C program - (It was a gtk based one) and get errors saying "traditional headermap style is no longer supported please migrate to use separate hedermaps"

What is a headermap?

Googling for headermap and C/C/Objective-C only takes me back to this Xcode error message

Searching on Apple Devreloper site returns no results no useful information - it does find

The legacy header map that was generated when the Always Search User Paths (ALWAYS_SEARCH_USER_PATHS) setting was YES is not supported by the new build system. Instead, set ALWAYS_SEARCH_USER_PATHS to NO and migrate to using modern header include syntax. Add any needed header files that are in the project repository to the Xcode project to ensure they are available for use in #include (via the project wide header map). Use quote-style include ("example.h") for project headers, and reserve angle-bracket include (<example.h>) for system headers.

What is "modern header include syntax" and what standard is it defined in (or anywhere it is defined)

Where is the term headermap defined and what is it?

question from:https://stackoverflow.com/questions/65943369/what-is-a-headermap-in-c-or-c-or-objective-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From this link , author Mark Mentovai

By default, Xcode uses a "header map" to communicate includes to gcc. The header map is supposed to be an optimization to reduce repetitive on-disk searching by the compiler. A header map is structured essentially as a hash table, keyed by names used in #includes, and providing pathnames to the actual files. Generally speaking, the header maps produced by Xcode provide access to all of the header files in either a target or a project file. Xcode informs the compiler to use one or more header maps by passing an -I or -iquote argument referencing the header map file instead of a directory. The compiler integrates header maps into its normal search order, except when encountering an -I or -iquote corresponding to a header map, it queries the header map file instead of searching a directory.

Header maps have spoiled several perfectly good days for me, so I always disable them in Xcode now by setting USE_HEADERMAP = NO. However, they're on by default and the setting to disable them doesn't have any UI, so most projects wind up relying on the header map, whether they intend to or not.

The header map file format isn't documented publicly as far as I know, but the format is simple and is understood by Apple gcc. Relevant source code is available at:

http://www.opensource.apple.com/darwinsource/DevToolsOct2008/gcc_42-5566/libcpp/include/cpplib.h http://www.opensource.apple.com/darwinsource/DevToolsOct2008/gcc_42-5566/gcc/c-incpath.c

Also refer to the header map rewriter in the distccd server at src/xci_headermap.c.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...