【问题标题】:Can't compile C++ plug-ins with OSX Lion?无法用 OSX Lion 编译 C++ 插件?
【发布时间】:2012-03-17 00:42:53
【问题描述】:

我一直在用 C++ 为 Maya 编写插件。我使用的 Makefile 在 Snow Leopard 上运行良好,但在 Lion 上却不行。在这两种情况下,我都使用最新版本的 Maya 2012。这是错误堆栈的顶部:

/Applications/Autodesk/maya2012/Maya.app/Contents/../../devkit/include/maya/OpenMayaMac.h:89:35: error: 
    AvailabilityMacros.h: No such file or directory
/Applications/Autodesk/maya2012/Maya.app/Contents/../../devkit/include/maya/OpenMayaMac.h:107:24: error: 
    sys/param.h: No such file or directory
/Applications/Autodesk/maya2012/Maya.app/Contents/../../devkit/include/maya/OpenMayaMac.h:114:40: error: 
    CoreServices/CoreServices.h: No such file or directory

这让我觉得这些文件在 Lion 中的不同位置,但我确实在我的 /usr/include/ 目录中看到了它们,就像 Snow Leopard 一样。有人有类似的问题、想法、建议吗?

我使用的make文件如下:

# NOTE: MAYA_LOCATION on Mac OS X points to Maya.app/Contents
MAYA_LOCATION = /Applications/Autodesk/maya2012/Maya.app/Contents

# Change location if a non standard install.
DEVKIT_LOCATION = $(MAYA_LOCATION)/../../devkit

C++ =  g++

PREFERRED_ARCHITECTURE =

# Determine the architectures to build.
MAYABIN = ${MAYA_LOCATION}/bin/maya
MAYA_ARCHES = $(shell lipo -info $(MAYABIN) | sed 's/^.*://')

ifneq ($(PREFERRED_ARCHITECTURE),)
    MAYA_ARCHES = $(filter $(PREFERRED_ARCHITECTURE),$(MAYA_ARCHES))

    ifeq ($(MAYA_ARCHES),)
        $(error $(MAYABIN) does not support the '$(PREFERRED_ARCHITECTURE)' architecture.)
    endif
endif

ARCH_FLAGS =    $(patsubst %,-arch %,$(MAYA_ARCHES))

CFLAGS =    -DAW_NEW_IOSTREAMS -DCC_GNU_ -DOSMac_ -DOSMacOSX_ \
        -DOSMac_MachO_ -DREQUIRE_IOSTREAM -fno-gnu-keywords -fpascal-strings -O3 \
        $(ARCH_FLAGS) -D_LANGUAGE_C_PLUS_PLUS -isysroot /Developer/SDKs/MacOSX10.6.sdk \
        -include $(MAYA_LOCATION)/../../devkit/include/maya/OpenMayaMac.h \
        -shared

C++FLAGS =  $(CFLAGS)

INCLUDES =  -I. -I$(MAYA_LOCATION)/../../devkit/include

LDFLAGS =   -framework Carbon -framework OpenGL -framework GLUT -lOpenMayaUI

LD =        $(MAYA_LOCATION)/../../devkit/bin/mayald MAYA_ARCHES="$(MAYA_ARCHES)" MAYA_LOCATION="$(MAYA_LOCATION)"


all: VmExample.bundle


VmExampleNode.o: VmExampleNode.cpp 
    $(C++) -c VmExampleNode.cpp $(C++FLAGS) $(INCLUDES)

vmPluginMain.o: vmPluginMain.cpp
    $(C++) -c vmPluginMain.cpp $(C++FLAGS) $(INCLUDES)

VmExample.bundle: VmExampleNode.o vmPluginMain.o
$(LD) -dynamic -bundle -o VmExample.bundle VmExampleNode.o vmPluginMain.o ../core/libVexample.o $(LDFLAGS)

【问题讨论】:

    标签: c++ plugins maya


    【解决方案1】:

    同样的问题;设法通过添加使其工作 -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk

    到 C++ 标志

    【讨论】:

    • 感谢您的回复,您的更改非常有效 - 我不记得当时我还需要做什么,但它非常少。
    猜你喜欢
    • 1970-01-01
    • 2012-12-16
    • 1970-01-01
    • 1970-01-01
    • 2020-07-06
    • 1970-01-01
    • 1970-01-01
    • 2012-07-25
    • 1970-01-01
    相关资源
    最近更新 更多