- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 C++ 的新手,由于统一要求,我们都在使用代码块。我在 10.10.5 OS X 上使用它。现在我必须做一个使用 allegro5 库的项目,但我无法安装它!我花了很多时间尝试学习不同的教程,例如 http://partitionseven.blogspot.com/2011/01/compiling-allegro-5-with-mac-os-x-snow.html完全没有成功。有什么办法让它工作吗?
编辑
我在指定 clang 工具时首先遇到了一个问题——我的 mac 上没有这样的目录/Developer/usr/bin/clang。我只能直接在 finder 中找到 usr/bin/clang,但是文件夹 usr 是灰色的——这意味着什么吗?只有当我点击 Xcode->show contents 时,我才能找到这个路径/Developer/usr/bin/clang。所以这是第一件事,与教程中的不完全一样。我仍然能够运行 CMAKE,但我得到了这样的日志:
The C compiler identification is AppleClang 6.1.0.6020053
The CXX compiler identification is AppleClang 6.1.0.6020053
Check for working C compiler: /usr/bin/clang
Check for working C compiler: /usr/bin/clang -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Check if the system is big endian
Searching 16 bit integer
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of unsigned short
Check size of unsigned short - done
Using unsigned short
Check if the system is big endian - little endian
Looking for include file dirent.h
Looking for include file dirent.h - found
Looking for include file inttypes.h
Looking for include file inttypes.h - found
Looking for include files sys/types.h, linux/joystick.h
Looking for include files sys/types.h, linux/joystick.h - not found
Looking for include file stdbool.h
Looking for include file stdbool.h - found
Looking for include file stdint.h
Looking for include file stdint.h - found
Looking for include file sys/io.h
Looking for include file sys/io.h - not found
Looking for include file sys/stat.h
Looking for include file sys/stat.h - found
Looking for include file sys/time.h
Looking for include file sys/time.h - found
Looking for include file time.h
Looking for include file time.h - found
Looking for include file sys/utsname.h
Looking for include file sys/utsname.h - found
Looking for include file sys/types.h
Looking for include file sys/types.h - found
Looking for include file soundcard.h
Looking for include file soundcard.h - not found
Looking for include file sys/soundcard.h
Looking for include file sys/soundcard.h - not found
Looking for include file machine/soundcard.h
Looking for include file machine/soundcard.h - not found
Looking for include file linux/soundcard.h
Looking for include file linux/soundcard.h - not found
Looking for include file libkern/OSAtomic.h
Looking for include file libkern/OSAtomic.h - found
Looking for include file sys/inotify.h
Looking for include file sys/inotify.h - not found
Looking for include file sys/timerfd.h
Looking for include file sys/timerfd.h - not found
Looking for getexecname
Looking for getexecname - not found
Looking for mkstemp
Looking for mkstemp - found
Looking for mmap
Looking for mmap - found
Looking for mprotect
Looking for mprotect - found
Looking for sched_yield
Looking for sched_yield - found
Looking for sysconf
Looking for sysconf - found
Looking for fseeko
Looking for fseeko - found
Looking for ftello
Looking for ftello - found
Check size of _Bool
Check size of _Bool - done
Performing Test ALLEGRO_HAVE_PROCFS_ARGCV
Performing Test ALLEGRO_HAVE_PROCFS_ARGCV - Failed
Performing Test ALLEGRO_HAVE_SV_PROCFS_H
Performing Test ALLEGRO_HAVE_SV_PROCFS_H - Failed
Performing Test ALLEGRO_HAVE_VA_COPY
Performing Test ALLEGRO_HAVE_VA_COPY - Success
Check if constructors are supported - yes
Found OpenGL: /System/Library/Frameworks/OpenGL.framework
Looking for pthread.h
Looking for pthread.h - found
Looking for pthread_create
Looking for pthread_create - found
Found Threads: TRUE
Found OpenAL: /System/Library/Frameworks/OpenAL.framework
Found FLAC: /usr/local/include
Performing Test FLAC_COMPILES
Performing Test FLAC_COMPILES - Success
Could NOT find DUMB (missing: DUMB_INCLUDE_DIR DUMB_LIBRARY)
WARNING: libdumb not found, disabling support. <http://dumb.sourceforge.net/>
Found VORBIS: /usr/local/include
Performing Test VORBIS_COMPILES
Performing Test VORBIS_COMPILES - Success
Found Freetype: /usr/local/lib/libfreetype.dylib (found version "2.6.3")
Found ZLIB: /usr/lib/libz.dylib (found version "1.2.8")
Found PhysFS: /usr/local/lib/libphysfs.dylib
Found PHYSFS: /usr/local/lib/libphysfs.dylib
Performing Test PHYSFS_IMPLICIT_ZLIB
Performing Test PHYSFS_IMPLICIT_ZLIB - Success
Could NOT find LATEX (missing: LATEX_COMPILER)
Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
allegro
allegro_acodec
allegro_audio
allegro_color
allegro_dialog
allegro_font
allegro_image
allegro_main
allegro_memfile
allegro_physfs
allegro_primitives
allegro_ttf
This warning is for project developers. Use -Wno-dev to suppress it.
Generating done
CMake生成的文件是
MacBook-Air-ukasz:build lukasz$ ls
CMakeCache.txt cmake_install.cmake include
CMakeFiles demos lib
Makefile docs tests
addons examples
谢谢@MikeKinghan,看来我更进了一步——我没有收到错误。但是我打开了代码块,粘贴了示例代码(教程中的代码),并且在编译时出现错误
g++ -c /Users/lukasz/Desktop/test_allegro/test.cpp -o /Users/lukasz/Desktop/test_allegro/test.o
g++ -o /Users/lukasz/Desktop/test_allegro/test /Users/lukasz/Desktop/test_allegro/test.o
Undefined symbols for architecture x86_64:
"_al_clear_to_color", referenced from:
__al_mangled_main in test.o
"_al_create_display", referenced from:
__al_mangled_main in test.o
"_al_destroy_display", referenced from:
__al_mangled_main in test.o
"_al_flip_display", referenced from:
__al_mangled_main in test.o
"_al_install_system", referenced from:
__al_mangled_main in test.o
"_al_map_rgb", referenced from:
__al_mangled_main in test.o
"_al_rest", referenced from:
__al_mangled_main in test.o
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: __al_mangled_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
编辑
当我使用
从终端运行测试应用程序时gcc alleg5test.c -o alleg5test -L/usr/local/lib -lallegro -lallegro_main
./alleg5test
它起作用了——我得到了一个黑屏。所以可能我必须“用代码块加入图书馆。任何想法 - 我只找到了一个适用于 Windows 的教程。
最佳答案
由于 SO 限制,我无法回复,但有一种可能性:您的 Allegro 库是为 i386 构建的,不包括 x86_64 架构。您可以在命令行上检查库,但它不会总是告诉您您拥有什么,除非您同时拥有 i386 和 x86_64。你这样做:
文件 liballegro.a
或 文件 liballegro.dylib
如果它说的是关于 x86_64 的任何内容,那我就错了。如果不是,那可能是问题所在。然后您有两个选择:要么将 Allegro 构建为 x86_64,要么将您的程序构建为 i386。要将 Allegro 构建为 x86_64 和 i386,请将以下内容添加到您的 CMake 命令中,如下所示:
cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;i386"...
或者只在 cmake-gui 中指定该变量。您可以通过删除它和分号来省略一个或另一个。
现在要构建具有特定架构的程序,如果您像链接的教程一样从命令行使用 gcc,请使用 -m
开关。要为 i386 构建,请使用 -m32
并为 x86_64 构建使用 -m64
(或者您可以为两者都使用 -arch i386 -arch x86_64
我相信(不确定,现在不在 Mac 上。)所以你的命令是:
gcc -m64 ...
其中 ... 与之前相同。
关于c++ - 代码块 osx 快板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37726148/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!