从源代码编译FreeImage。 #include FreeImage.h找不到 [英] Compiled FreeImage from source. #include FreeImage.h not found

查看:2615
本文介绍了从源代码编译FreeImage。 #include FreeImage.h找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在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> //未找到



我假设我需要将FreeImage.h添加到Mac OS X环境路径,除了我不知道哪个路径是正确的,因为有几个不同的文件存储环境路径变量。



我需要做什么来获得FreeImage



这是我的 Makefile.osx 的第一部分是这有助于:

 # -  *  -  Makefile  -  *  -  
#Free Mac的Mac OSX makefile

#此文件可由./gensrclist.sh
生成,包括Makefile.srcs

#常规配置变量:
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_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,然后重新生成, / p>

  CFLAGS = -I / usr / local / include 
LDFLAGS = -L / usr / local / lib


解决方案

' INCLUDE + = '线看起来像攻击者:

  INCLUDE + = -I / usr / local / include 

如果库缺失,那么您将需要找到另一行添加 -L / usr / include / lib '到。


I have compiled FreeImage 3.10.0 from source at /lib/FreeImage on Mac OS X 10.6.

I can see that after compilation these files were copied:

/usr/local/lib/libfreeimage-3.10.0.dylib
/usr/local/lib/libfreeimage.a
/usr/local/include/FreeImage.h

CMake cannot find FreeImage, but I cannot even do

#include <FreeImage.h>  // not found

I am assuming I need to add FreeImage.h to the Mac OS X environment path, except I don't know which path is the right one as there are a few different files which store environment path variables.

What do I need to do to get FreeImage header to be found by my C++ app or CMake?

Here is the first part of my Makefile.osx is this helps:

# -*- 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

Update: I added these lines into my Makefile as per Nicholas' instructions, then rebuilt but this didn't work:

CFLAGS = -I/usr/local/include
LDFLAGS = -L/usr/local/lib

解决方案

The 'INCLUDE +=' line looks like the one to attack:

INCLUDE += -I/usr/local/include

If the library is missing too, then you will need to find another line to add '-L/usr/include/lib' to.

这篇关于从源代码编译FreeImage。 #include FreeImage.h找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆