在MacOS上
得到Sample Code
OpenGL安装步骤:
- 检查在Terminal上已经安装
g++/clang++
g++ -v
- 安装Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- 安装cmake和GLFW
# CMake tool to compile brew install cmake # The Library GLFW brew install glfw
期间可能会出现的问题:
Error:Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
解决方法:
brew install pkg-config
OpenGL检查安装成功:
移动到CMakeList所在的文件夹,在命令行运行下面代码
# Generate the directory build/
mkdir build
# Go to the build/ directory
cd build
# Run CMake
cmake ..
# A file Makefile should be generated
# Compile
make
# Make sure the compilation succeed, a file pgm should be created
# Go back to the root directory
cd ..
# Run the executable from the root directory
# (possibly adapt to the name of your executable)
build/sample_code
结果:
QtCreator安装
brew install qt
brew install qt-creator
运行时候的问题及解决方案
Expected in: /usr/local/lib/libJPEG.dylib in /System/Library/Frameworks/Imag
在运行选项中找到Add build library search path to DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH,保证它没有被选中。