免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 20501 | 回复: 5
打印 上一主题 下一主题

在makefile中如何指定系统include路径 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-12 12:33 |只看该作者 |倒序浏览
在编译一个源程序时,
系统提示
SiphonSettings.h:25:34: error: no include path in which to search for Foundation/Foundation.h

Foundation.h的路径我是知道的,是系统库

但源码的makefile中没有指定

我现在就是不知道如何手工提定,让源码能在 编译时找到系统的H文件

论坛徽章:
5
2 [报告]
发表于 2009-03-12 12:40 |只看该作者
-I后面加路径

论坛徽章:
5
3 [报告]
发表于 2009-03-12 12:42 |只看该作者
$ make --help
Usage: make [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d                          Print lots of debugging information.
  --debug[=FLAGS]             Print various types of debugging information.
  -e, --environment-overrides
                              Environment variables override makefiles.
  -f FILE, --file=FILE, --makefile=FILE
                              Read FILE as a makefile.
  -h, --help                  Print this message and exit.
  -i, --ignore-errors         Ignore errors from commands.
  -I DIRECTORY, --include-dir=DIRECTORY
                              Search DIRECTORY for included makefiles.
  -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.
  -k, --keep-going            Keep going when some targets can't be made.
  -l [N], --load-average[=N], --max-load[=N]
                              Don't start multiple jobs unless load is below N.
  -L, --check-symlink-times   Use the latest mtime between symlinks and target.
  -n, --just-print, --dry-run, --recon
                              Don't actually run any commands; just print them.
  -o FILE, --old-file=FILE, --assume-old=FILE
                              Consider FILE to be very old and don't remake it.
  -p, --print-data-base       Print make's internal database.
  -q, --question              Run no commands; exit status says if up to date.
  -r, --no-builtin-rules      Disable the built-in implicit rules.
  -R, --no-builtin-variables  Disable the built-in variable settings.
  -s, --silent, --quiet       Don't echo commands.
  -S, --no-keep-going, --stop
                              Turns off -k.
  -t, --touch                 Touch targets instead of remaking them.
  -v, --version               Print the version number of make and exit.
  -w, --print-directory       Print the current directory.
  --no-print-directory        Turn off -w, even if it was turned on implicitly.
  -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
                              Consider FILE to be infinitely new.
  --warn-undefined-variables  Warn when an undefined variable is referenced.

This program built for i686-pc-cygwin
Report bugs to <bug-make@gnu.org>

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
4 [报告]
发表于 2009-03-12 13:39 |只看该作者
在Makefile中的
all:前加上

CFLAGS   += -I你的头文件路径
CXXFLAGS   += -I你的头文件路径

论坛徽章:
0
5 [报告]
发表于 2009-03-12 14:37 |只看该作者
makefile


CC=arm-apple-darwin9-gcc
CXX=arm-apple-darwin9-g++
LD=$(CC)

PRODUCT_NAME = Siphon
SETTINGS_NAME=$(PRODUCT_NAME)Settings
SETTINGS_BUNDLE=$(SETTINGS_NAME).bundle
BUILT_PRODUCTS_DIR = ../dist


LDFLAGS= -Wall -lobjc \
        -framework CoreFoundation \
        -framework Foundation \
        -framework Preferences \
       
CFLAGS= -O2

TARGET=$(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/$(SETTINGS_NAME)
VERSION=1.9.9

SOURCES=\
        SiphonSettings.m


OBJECTS= \
        $(patsubst %.c,%.o,$(filter %.c,$(SOURCES))) \
        $(patsubst %.m,%.o,$(filter %.m,$(SOURCES)))

LANGUAGES= \
        $(wildcard *.lproj)
       
PLIST= \
        $(wildcard *.plist)

all:        $(TARGET)

$(TARGET): $(OBJECTS)
        mkdir -p $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)
        $(LD) $(LDFLAGS) -bundle -o $@ $^
        cp Siphon.plist Advanced.plist $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/
        cp icon.png $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/
        for i in $(LANGUAGES); do \
                mkdir -p $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/$$i; \
                cp $$i/Localizable.strings $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/$$i; \
        done

%.o:        %.m
        $(CC) -Wall -c $(CFLAGS) $(CPPFLAGS) $< -o $@

%.o:        %.c
        $(CC) -Wall -c $(CFLAGS) $(CPPFLAGS) $< -o $@

clean:
        rm -rf $(OBJECTS)


++++++++++++++++++
需要头文件的路径有
/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Frameworks.framework/Headers/Foundation.h

/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Uikit.framework/Headers/UIKit.h

/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/privateFrameworks/Preferences.frameworks/PSListController.h

在makefile中怎么指定系统的include目录呢

[ 本帖最后由 ltaotao007 于 2009-3-12 15:29 编辑 ]

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
6 [报告]
发表于 2009-03-12 16:11 |只看该作者
makefile


  1. CC=arm-apple-darwin9-gcc
  2. CXX=arm-apple-darwin9-g++
  3. LD=$(CC)

  4. PRODUCT_NAME = Siphon
  5. SETTINGS_NAME=$(PRODUCT_NAME)Settings
  6. SETTINGS_BUNDLE=$(SETTINGS_NAME).bundle
  7. BUILT_PRODUCTS_DIR = ../dist


  8. LDFLAGS= -Wall -lobjc \
  9.         -framework CoreFoundation \
  10.         -framework Foundation \
  11.         -framework Preferences \
  12.         
  13. CFLAGS= -O2 -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Frameworks.framework/Headers/  -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Frameworks.framework/  -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Uikit.framework/Headers/ -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Uikit.framework -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/privateFrameworks/Preferences.frameworks/ -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/privateFrameworks

  14. CXXFLAGS= -O2 -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Frameworks.framework/Headers/  -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Frameworks.framework/  -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Uikit.framework/Headers/ -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/Frameworks/Uikit.framework -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/privateFrameworks/Preferences.frameworks/ -I/Developer/Platforms/iPhoneOs.platform/Developer/SDKs/iPhoneOS2.1.sdk/System/Libray/privateFrameworks

  15. TARGET=$(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/$(SETTINGS_NAME)
  16. VERSION=1.9.9

  17. SOURCES=\
  18.         SiphonSettings.m


  19. OBJECTS= \
  20.         $(patsubst %.c,%.o,$(filter %.c,$(SOURCES))) \
  21.         $(patsubst %.m,%.o,$(filter %.m,$(SOURCES)))

  22. LANGUAGES= \
  23.         $(wildcard *.lproj)
  24.         
  25. PLIST= \
  26.         $(wildcard *.plist)

  27. all:        $(TARGET)

  28. $(TARGET): $(OBJECTS)
  29.         mkdir -p $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)
  30.         $(LD) $(LDFLAGS) -bundle -o $@ $^
  31.         cp Siphon.plist Advanced.plist $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/
  32.         cp icon.png $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/
  33.         for i in $(LANGUAGES); do \
  34.                 mkdir -p $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/$$i; \
  35.                 cp $$i/Localizable.strings $(BUILT_PRODUCTS_DIR)/$(SETTINGS_BUNDLE)/$$i; \
  36.         done

  37. %.o:        %.m
  38.         $(CC) -Wall -c $(CFLAGS) $(CPPFLAGS) $< -o $@

  39. %.o:        %.c
  40.         $(CC) -Wall -c $(CFLAGS) $(CPPFLAGS) $< -o $@

  41. clean:
  42.         rm -rf $(OBJECTS)

复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP