- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我确实需要一些帮助来解决这个问题。自 5 天以来,我一直在努力解决这个问题,当我尝试了几乎所有我能在互联网上找到的想法时,我快要疯了……
当我使用 Cmake 生成的 makefile 编译我的 C++ 项目时,代码编译到 100%,但随后无法链接 OGRE 框架并退出并出现错误 1。
由于我无法使用自己的项目进行编译,而且我的程序无法找到的框架是 OGRE 框架,所以我尝试使用 files随 Ogre3D 设置一起提供 tutorial最大限度地简化问题。但问题和错误仍然完全相同,编译过程停止:
ld: framework not found OGRE
我试图将 OgreSDK/lib/release 中的 Ogre.framework 复制到系统的默认/Library/Framework 以及这台计算机上几乎所有地方,包括项目文件夹(对 OgreFindFrameWork.cmake 文件进行了修改),尤其是 OgreFindFrameWork.cmake 文件所针对的所有文件夹,但此错误仍然存在。
我也尝试了很多Cmake修改或使用Xcode编译,但由于它总是以相同的错误信息结束,我决定用最简单的一个来说明这个问题。因此,以下信息与上面指出的 OGRETutorialFramework 调试项目有关。
有谁能解释我需要更改什么以使链接器能够找到定义的框架(我想这不是 Ogre 框架特有的问题,我可能会在另一个框架中遇到相同的错误)?
谢谢。
以下部分索引:
- 1/制作日志
- 2/OGRETutorialFramework的CMakeFile.txt
- 3/使用软件的版本
- 1/make 生成和构建日志
这是生成过程的日志:
Valkeas-Mac:OGRETutorialFramework root# make
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detected g++ 4.0.1
-- Enabling GCC visibility flags
-- Looking for OGRE...
-- OGRE_PREFIX_WATCH changed.
-- Found Ogre Cthugha (1.7.3)
-- Found OGRE: -framework OGRE
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: -framework OGRE
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: /Volumes/Data/OgreSDK/lib/libOgreTerrain.dylib
-- Looking for OGRE_Property...
-- Found OGRE_Property: /Volumes/Data/OgreSDK/lib/libOgreProperty.dylib
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: /Volumes/Data/OgreSDK/lib/libOgreRTShaderSystem.dylib
-- Looking for OIS...
-- Found OIS: /Volumes/Data/OgreSDK/lib/release/libOIS.a
-- Configuring done
-- Generating done
如您所见,已找到框架(-- Found OGRE: -framework OGRE)。
这是构建过程的日志:
-- Build files have been written to: /var/root/Desktop/OGRETutorialFramework
Scanning dependencies of target OGRETutorialFramework
[ 50%] Building CXX object CMakeFiles/OGRETutorialFramework.dir/BaseApplication.cpp.o
[100%] Building CXX object CMakeFiles/OGRETutorialFramework.dir/TutorialApplication.cpp.o
Linking CXX executable OGRETutorialFramework.app/Contents/MacOS/OGRETutorialFramework
ld: framework not found OGRE
collect2: ld returned 1 exit status
make[2]: *** [OGRETutorialFramework.app/Contents/MacOS/OGRETutorialFramework] Error 1
make[1]: *** [CMakeFiles/OGRETutorialFramework.dir/all] Error 2
make: *** [all] Error 2
Valkeas-Mac:OGRETutorialFramework root#
如你所见,它无法找到 OGRE 框架(ld: framework not found OGRE)
- 2/OGRETutorialFramework调试工程的CMakeFile.txt
我的 Ogre SDK 位于我的第二个名为“Data”的硬盘上,所以我使用路径:/Volumes/Data/OgreSDK
这是我当前用于 OGRETutorialFramework 的 CMakeList.txt(在 Ogre 设置教程中提供的那个,略微修改以匹配我的文件夹路径)。
cmake_minimum_required(VERSION 2.6)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
cmake_policy(SET CMP0003 NEW)
set(OGRE_HOME "/Volumes/Data/OgreSDK")
set(Boost_INCLUDE_DIR "${OGRE_HOME}/boost_1_46_1")
# Use relative paths
# This is mostly to reduce path size for command-line limits on windows
if(WIN32)
# This seems to break Xcode projects so definitely don't enable on Apple builds
set(CMAKE_USE_RELATIVE_PATHS true)
set(CMAKE_SUPPRESS_REGENERATION true)
set(CMAKE_MODULE_PATH "${OGRE_HOME}/CMake/;${CMAKE_MODULE_PATH}")
set(OGRE_SAMPLES_INCLUDEPATH
${OGRE_HOME}/Samples/include)
endif()
# Assign compiler for Mac OS X-based systems
# NOTE: This logic is order-dependent and must occur here because the
# configuration phase of CMake projects will fall into an infinite loop
# if compiler assignments are modified after issuing a project(...) command.
#
if (OGRE_BUILD_PLATFORM_IPHONE)
# Force gcc <= 4.2 on iPhone
include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
elseif (APPLE AND NOT OGRE_BUILD_PLATFORM_IPHONE)
# Force gcc <= 4.0 on Mac OS X because 4.2 is not supported prior to Mac OS X 10.5
include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(gcc-4.0 GNU)
CMAKE_FORCE_CXX_COMPILER(gcc-4.0 GNU)
endif ()
set(OGRE_PROJECT_NAME
"OGRETutorialFramework"
)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/build/bin")
project(${OGRE_PROJECT_NAME})
# Include necessary submodules
# set(OGRE_SOURCE_DIR "/Applications/OgreSDK")
set(OGRE_SOURCE_DIR "/Volumes/Data/OgreSDK")
set(CMAKE_MODULE_PATH
"${OGRE_SOURCE_DIR}/CMake"
"${OGRE_SOURCE_DIR}/CMake/Utils"
"${OGRE_SOURCE_DIR}/CMake/Packages"
)
set(OGRE_SAMPLES_INCLUDEPATH
"${OGRE_SOURCE_DIR}/Samples/Common/include"
)
include(CMakeDependentOption)
include(CheckCXXCompilerFlag)
include(MacroLogFeature)
include(OgreConfigTargets)
include(PreprocessorUtils)
set(OGRE_TEMPLATES_DIR "${OGRE_SOURCE_DIR}/CMake/Templates")
#####################################################################
# Set up the basic build environment
#####################################################################
if (CMAKE_BUILD_TYPE STREQUAL "")
# CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
# differentiation between debug and release builds.
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
if (NOT APPLE)
# Create debug libraries with _d postfix
set(CMAKE_DEBUG_POSTFIX "_d")
endif ()
# Set compiler specific build flags
if (CMAKE_COMPILER_IS_GNUCXX)
check_cxx_compiler_flag(-msse OGRE_GCC_HAS_SSE)
if (OGRE_GCC_HAS_SSE)
add_definitions(-msse)
endif ()
endif ()
if (MSVC)
if (CMAKE_BUILD_TOOL STREQUAL "nmake")
# set variable to state that we are using nmake makefiles
set(NMAKE TRUE)
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
# Enable intrinsics on MSVC in debug mode
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Oi")
if (CMAKE_CL_64)
# Visual Studio bails out on debug builds in 64bit mode unless
# this flag is set...
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /bigobj")
endif ()
endif ()
if (MINGW)
add_definitions(-D_WIN32_WINNT=0x0500)
endif ()
if (CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
# Test for GCC visibility
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fvisibility=hidden OGRE_GCC_VISIBILITY)
if (OGRE_GCC_VISIBILITY)
# determine gcc version
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
OUTPUT_VARIABLE OGRE_GCC_VERSION)
message(STATUS "Detected g++ ${OGRE_GCC_VERSION}")
message(STATUS "Enabling GCC visibility flags")
set(OGRE_GCC_VISIBILITY_FLAGS "-DOGRE_GCC_VISIBILITY -fvisibility=hidden")
# check if we can safely add -fvisibility-inlines-hidden
string(TOLOWER "${CMAKE_BUILD_TYPE}" OGRE_BUILD_TYPE)
if (OGRE_BUILD_TYPE STREQUAL "debug" AND OGRE_GCC_VERSION VERSION_LESS "4.2")
message(STATUS "Skipping -fvisibility-inlines-hidden due to possible bug in g++ < 4.2")
else ()
set(OGRE_GCC_VISIBILITY_FLAGS "${OGRE_GCC_VISIBILITY_FLAGS} -fvisibility-inlines-hidden")
endif ()
endif (OGRE_GCC_VISIBILITY)
# Fix x64 issues on Linux
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE)
add_definitions(-fPIC)
endif()
endif (CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
# determine system endianess
#include(TestBigEndian)
#test_big_endian(OGRE_TEST_BIG_ENDIAN)
set(OGRE_TEST_BIG_ENDIAN FALSE)
# Add OgreMain include path
include_directories("${OGRE_SOURCE_DIR}/OgreMain/include")
include_directories("${OGRE_BINARY_DIR}/include")
if (APPLE)
if (OGRE_BUILD_PLATFORM_IPHONE)
include_directories("${OGRE_SOURCE_DIR}/OgreMain/include/iPhone")
# Set static early for proper dependency detection
set(OGRE_STATIC TRUE)
else ()
include_directories("${OGRE_SOURCE_DIR}/OgreMain/include/OSX")
endif ()
endif (APPLE)
find_package(OGRE REQUIRED)
if(NOT "${OGRE_VERSION_NAME}" STREQUAL "Cthugha")
message(SEND_ERROR "You need Ogre 1.7 Cthugha to build this.")
endif()
find_package(OIS REQUIRED)
if(NOT OIS_FOUND)
message(SEND_ERROR "Failed to find OIS.")
endif()
# Find Boost
if (NOT OGRE_BUILD_PLATFORM_IPHONE)
if (WIN32 OR APPLE)
set(Boost_USE_STATIC_LIBS TRUE)
else ()
# Statically linking boost to a dynamic Ogre build doesn't work on Linux 64bit
set(Boost_USE_STATIC_LIBS ${OGRE_STATIC})
endif ()
if (MINGW)
# this is probably a bug in CMake: the boost find module tries to look for
# boost libraries with name libboost_*, but CMake already prefixes library
# search names with "lib". This is the workaround.
set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "")
endif ()
set(Boost_ADDITIONAL_VERSIONS "1.42" "1.42.0" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" )
# Components that need linking (NB does not include header-only components like bind)
set(OGRE_BOOST_COMPONENTS thread date_time)
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
if (NOT Boost_FOUND)
# Try again with the other type of libs
set(Boost_USE_STATIC_LIBS NOT ${Boost_USE_STATIC_LIBS})
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
endif()
find_package(Boost QUIET)
# Set up referencing of Boost
include_directories(${Boost_INCLUDE_DIR})
add_definitions(-DBOOST_ALL_NO_LIB)
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES})
endif()
set(HDRS
./BaseApplication.h
./TutorialApplication.h
)
set(SRCS
./BaseApplication.cpp
./TutorialApplication.cpp
)
include_directories( ${OIS_INCLUDE_DIRS}
${OGRE_INCLUDE_DIRS}
${OGRE_SAMPLES_INCLUDEPATH}
)
add_executable(${OGRE_PROJECT_NAME} WIN32 ${HDRS} ${SRCS})
set_target_properties(${OGRE_PROJECT_NAME} PROPERTIES DEBUG_POSTFIX _d)
target_link_libraries(${OGRE_PROJECT_NAME} ${OGRE_LIBRARIES} ${OIS_LIBRARIES})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/bin)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/media)
# post-build copy for win32
if(WIN32 AND NOT MINGW)
add_custom_command( TARGET ${OGRE_PROJECT_NAME} PRE_BUILD
COMMAND if not exist .\\dist\\bin mkdir .\\dist\\bin )
add_custom_command( TARGET ${OGRE_PROJECT_NAME} POST_BUILD
COMMAND copy \"$(TargetPath)\" .\\dist\\bin )
endif(WIN32 AND NOT MINGW)
if(MINGW)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/dist/bin)
endif(MINGW)
if(WIN32)
install(TARGETS ${OGRE_PROJECT_NAME}
RUNTIME DESTINATION bin
CONFIGURATIONS All)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/dist/Media
DESTINATION ./
CONFIGURATIONS Release RelWithDebInfo Debug
)
install(FILES ${CMAKE_SOURCE_DIR}/dist/bin/plugins.cfg
${CMAKE_SOURCE_DIR}/dist/bin/resources.cfg
DESTINATION bin
CONFIGURATIONS Release RelWithDebInfo
)
install(FILES ${CMAKE_SOURCE_DIR}/dist/bin/plugins_d.cfg
${CMAKE_SOURCE_DIR}/dist/bin/resources_d.cfg
DESTINATION bin
CONFIGURATIONS Debug
)
install(FILES ${OGRE_PLUGIN_DIR_REL}/OgreMain.dll
${OGRE_PLUGIN_DIR_REL}/RenderSystem_Direct3D9.dll
${OGRE_PLUGIN_DIR_REL}/RenderSystem_GL.dll
${OGRE_PLUGIN_DIR_REL}/OIS.dll
DESTINATION bin
CONFIGURATIONS Release RelWithDebInfo
)
install(FILES ${OGRE_PLUGIN_DIR_DBG}/OgreMain_d.dll
${OGRE_PLUGIN_DIR_DBG}/RenderSystem_Direct3D9_d.dll
${OGRE_PLUGIN_DIR_DBG}/RenderSystem_GL_d.dll
${OGRE_PLUGIN_DIR_DBG}/OIS_d.dll
DESTINATION bin
CONFIGURATIONS Debug
)
endif(WIN32)
set_property(TARGET ${OGRE_PROJECT_NAME} PROPERTY MACOSX_BUNDLE TRUE)
- 3/所用软件的版本
OSX 版本:10.6.7(雪豹)
Xcode 版本:3.2.6
GCC 版本:4.6(4.5.3 不能编译到 100%,旧版本不支持我需要的 C++0x)食人魔版本:1.7.3
Cmake 版本:2.8.3 或 2.8.4(我都试过了)
最佳答案
我认为您遇到了 SDK 路径中重复框架的问题。您需要将您的框架从
/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks/Frameworks
到
/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks
然后修复符号链接(symbolic link)/Library/Frameworks
。
我在 Re[2]: не могу въехать в ошибку линковки 找到了解决方案:
If you are interested: The XCode gets standart library(
libstdc++-static.a
) depends from the current SDK configuration. Butlibstdc++-static.a
library from MacOS10.5.sdk configuration do notcontain_M_insert
,_M_extract
symbols. For fix this problem we needjust switch to the MacOSX10.6.sdk.BTW!!! If you are use XCode 3.2.6 you will encounter with surprise(bug) from Apple!
The folder:
/Developer/SDKs/MacOSX10.6.sdk/Library
contain the folderFrameworks
with linkFrameworks
inside. i.e.:/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks/Frameworks
This iswrong.If you will try to install and use third-party frameworks (for exampleCG.Frameworks), XCode doesn't find these framework. Because
/Developer/SDKs/MacOSX10.6.sdk/Library
must contain link to theFrameworks
folder BUT not theFramework
folder.Fortunately this problem easy to fix. You need just need rename the
Frameworks
to (for example)_Framework
. Then copy aliasFramework
fromthe/Developer/SDKs/MacOSX10.6.sdk/Library/_Frameworks/Frameworks
to/Developer/SDKs/MacOSX10.6.sdk/Library/
and then remove renamed folder_Frameworks
forewer.I repeat again this applies only for XCode 3.2.6
关于c++ - 在 Mac OS-X 上编译 C++ 程序时出现 "framework not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6275066/
This question already has an answer here: Character constant too long for it's type (1个答案) 1年前关闭。 我是
每次我执行 Scala 程序时,Eclipse 都会创建一个新的“运行配置”。这样做的问题是我需要自定义默认的运行配置(需要更改工作路径)。因此,我第一次创建和自定义运行配置时一切正常,但任何后续尝试
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 5 年前。 Improv
基本上我正在做的是创建一个充当启动器的 swing 应用程序。它所做的只是为用户提供了 3 个选项,他们可以从中选择打开一个新的 java 应用程序。 3 个不同的 java 应用程序都有不同的主题,
这个问题已经有答案了: Make a py2exe exe run without a console? (2 个回答) 已关闭 9 年前。 我不希望在打开 python 应用程序时在后台打开 cmd
我曾经尝试编译一个我为国际象棋游戏编写的 C 程序(感谢 YouTube 的 Bluefever Software 提供的教程),但是当我去编译该程序时,我执行了这行代码: C:\TDM-GCC-64
这是一段代码,通过从一个文件获取输入并在另一个文件中给出输出来执行数字的平方。 #include #include void main() { FILE *fp1, *fp2; char
#include using namespace std; class foo { private: static int cnt; // number in memory stat
我做了一个简单的 hello world 程序。我单击“开始调试”,窗口显示“项目已过期。您要构建它吗?”当我单击"is"时,下一个窗口显示“存在构建错误。您要继续并运行上次成功的构建吗?”。我再次选
这是一个程序,有人在其中输入密码并尝试三次猜密码。当我编译它时,我遇到了多个错误,其中一个包括第 13 行,它基本上说它找不到包含在 Password_Program 类中的类似函数。 #includ
我想将我的游戏导出到 .jar 文件中。它导出;当我运行它时,框架出现了,但面板没有加载。我的框架和面板位于两个不同的类文件中,但我认为这没有什么区别。而且,它在 Eclipse 中完全可以工作。我在
我粘贴了程序以从 codenameone 开发人员指南中创建一个按钮,并且我在 netbeans 中使用了该代码,但是当我单击“运行”时,它在模拟器中没有显示任何内容 最佳答案 您删除了 hi.sho
当我执行这个程序时,它并没有终止。 例如,如果我给它输入 A,输出将是: 65 7 1000001 0 65 7 1000001 ... 我的代码: #include #include void
考虑下面的基本客户端和服务器程序(只是骨架/说明我的问题)。客户端启动与服务器的连接,提示用户输入消息,然后发送到服务器并打印到屏幕。 如果我在循环中间突然退出客户端程序(例如通过关闭终端窗口),有时
我运行一个非常简单的单线程 Java 程序。当我在 Ubuntu 下使用命令检查线程时 ps -eLf 它显示操作系统级别有 14 个线程。我希望当程序有一个线程时只有一个线程,如果程序有 x 个线程
当我从命令行运行类似以下内容的代码时,真正发生了什么? > scala hello.scala 是否有hello.class生成,执行然后丢弃?还是在这种情况下Scala表现得像翻译一样?我只是在想,
程序正在从网络摄像机接收以字节为单位的图像数据,然后处理图像。程序第一次启动时使用470Mb RAM,每1秒增加到15Mb,一直持续到没有足够的空间而计算机挂起。 方法 getImage() 每 10
当我运行我的 selenium 程序时,它显示错误,如何解决这个问题? import org.openqa.selenium.By; public class sss { public sta
我写了一个简单的程序,试图查看内存中的变化,但没有任何变化。无论我是否运行代码,总是会出现大约 20% 左右的直线水平线。 #include using namespace std; int main
我是 c/c++ 领域的新手,我已经在虚拟机上沉迷太久了。 我正在修改我们在整个公司使用的现有 C++ 工具。该工具正在所有主要操作系统(Windows、Mac、Ubuntu、Solaris 等)上使
我是一名优秀的程序员,十分优秀!