我已经在Mac OS X 10.6的/ lib / FreeImage上从源代码编译了FreeImage 3.10.0。
我可以看到编译后这些文件被复制了:
/usr/local/lib/libfreeimage-3.10.0.dylib
/usr/local/lib/libfreeimage.a
/usr/local/include/FreeImage.h
CMake找不到FreeImage,但我什至找不到
#include <FreeImage.h> // not found
我假设我需要将FreeImage.h添加到Mac OS X环境路径中,除非我不知道哪个路径是正确的路径,因为有几个存储环境路径变量的文件不同。
我该怎么做才能使FreeImage标头可以被我的C ++应用程序或CMake找到?
这是我的
Makefile.osx
的第一部分,它会有所帮助:# -*- Makefile -*-
# Mac OSX makefile for FreeImage
# This file can be generated by ./gensrclist.sh
include Makefile.srcs
# General configuration variables:
CC_PPC = gcc-4.0
CC_I386 = gcc-4.0
CPP_PPC = g++-4.0
CPP_I386 = g++-4.0
COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden
COMPILERFLAGS_PPC = -arch ppc
COMPILERFLAGS_I386 = -arch i386
COMPILERPPFLAGS = -Wno-ctor-dtor-privacy
INCLUDE +=
INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.6.sdk
INCLUDE_I386 = -isysroot /Developer/SDKs/MacOSX10.6.sdk
CFLAGS_PPC = $(COMPILERFLAGS) $(COMPILERFLAGS_PPC) $(INCLUDE) $(INCLUDE_PPC)
CFLAGS_I386 = $(COMPILERFLAGS) $(COMPILERFLAGS_I386) $(INCLUDE) $(INCLUDE_I386)
CPPFLAGS_PPC = $(COMPILERPPFLAGS) $(CFLAGS_PPC)
CPPFLAGS_I386 = $(COMPILERPPFLAGS) $(CFLAGS_I386)
LIBRARIES_PPC = -Wl,-syslibroot /Developer/SDKs/MacOSX10.6.sdk
LIBRARIES_I386 = -Wl,-syslibroot /Developer/SDKs/MacOSX10.6.sdk
LIBTOOL = libtool
LIPO = lipo
更新:我按照尼古拉斯的指示将这些行添加到了我的Makefile中,然后进行了重新构建,但这没有用:
CFLAGS = -I/usr/local/include
LDFLAGS = -L/usr/local/lib
最佳答案
'INCLUDE +=
'行看起来像是要攻击的行:
INCLUDE += -I/usr/local/include
如果库也丢失了,那么您将需要查找另一行以将'
-L/usr/include/lib
'添加到其中。关于c++ - 从源代码编译FreeImage。 #include FreeImage.h未找到,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1891836/