How do I get rid of module.map warnings in the OSX

2019-05-04 10:00发布

问题:

Since updating Xcode to version 6.3, I have been getting the following warnings when compiling C++ code:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/module.map:1:25: warning: unknown attribute 'extern_c' [-Wignored-attributes]
module Darwin [system] [extern_c] {
                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/module.map:1561:21: warning: unknown attribute 'extern_c' [-Wignored-attributes]
module os [system] [extern_c] {
                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/module.map:1577:26: warning: unknown attribute 'extern_c' [-Wignored-attributes]
module libkern [system] [extern_c] {
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/module.map:1602:23: warning: unknown attribute 'extern_c' [-Wignored-attributes]
module ldap [system] [extern_c] {
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/module.map:1635:23: warning: unknown attribute 'extern_c' [-Wignored-attributes]
module krb5 [system] [extern_c] {
                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/module.map:1662:22: warning: unknown attribute 'extern_c' [-Wignored-attributes]
module XPC [system] [extern_c] {
                     ^

Does anyone have any idea how to fix this besides ignoring -Wignored-attributes?

回答1:

Turns out I was using an old version of clang with the SDK of Xcode. Using the default clang gets rid of the warnings.



标签: c++ xcode clang