使用 Gecode 运行第一个程序
Run first program with Gecode
拜托,我需要你的帮助。
我已经在 Windows 8 上安装了用于开发基于约束的系统和应用程序 Gecode 4.4.0 的工具包,也是 Dev C++ 5.9.2 C++编译器,但我仍然不知道如何运行我的第一个程序或 insallation 提供的示例。
我已经读到我需要一个制作文件,但实际上我还没有成功编译或执行。
编译命令:
g++.exe -D__DEBUG__ main.o sat.o -o TestGecode.exe -L"C:/Program Files (x86(/Dev-Cpp/MinGW64/lib32" -L"C:/Program Files (x86(/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc -L"C:/Program Files (x86(/Gecode/include" -m32 -g3
输出错误:
sat.o:在函数
ZN6Gecode9ExceptionD2Ev': c:/program files (x86)/dev-cpp/mingw64/x86_64-w64-mingw32/include/gecode/support/exception.hpp:46: undefined reference to
_imp___ZTVN6Gecode9ExceptionE中 sat.o:在 函数ZN6Gecode15MemoryExhaustedC1Ev': c:/program files (x86)/dev-cpp/mingw64/x86_64-w64-mingw32/include/gecode/support/exception.hpp:90: undefined reference to
_imp___ZN6Gecode9ExceptionC2EPKcS2_' sat.o: in 函数"ZNK6Gecode9PosChoice7archiveERNS_7ArchiveE":...
-L"C:/Program Files (x86(/Gecode/include">
提供 Gecode 标头的路径,而不是库的路径,作为库路径到 g++ 作为库路径。考虑使用
-L"C:/Program Files (x86(/Gecode/lib"
相反。
-L
仅将链接器指向查找库的位置。它不会告诉链接器要使用哪些库。 命令行上也需要-l <name of library>
。Gecode 文档应该告诉您要链接哪些库才能获得所需的函数。快速阅读表明 GecodeSupport 包含 Gecode::Exception
。不幸的是,它没有直接出来并在Gecode::Exception
文档页面上说出来。您应该需要将-lGecodeSupport<version number>
添加到命令行。
警告:如果您安装了Gecode网站上提供的任何Windows预打包版本,它们看起来都是Visual Studio的,并且GCC无法识别。如果您从源代码下载并构建了 Gecode,您应该很高兴。
- 为什么它只打印双链接列表的第一个值,而我的程序却崩溃了
- 我的程序有一个保存配置文件的GUI,如何双击此配置文件以直接加载带有配置数据的GUI?
- std::find,返回所有找到的值的替代方法,而不仅仅是存在重复的向量的第一个值
- 如何仅读取文本文件中的第一个值
- C++ 为什么程序只读取第一个值
- 在我的第一个C++程序中需要一些帮助(简单)
- 输入后,我的程序似乎跳过了第一个IF语句,直接转到ELSE
- 无法在Windows 10上使用Kaa教程运行程序-"您的第一个Kaa应用程序"
- 程序仅执行第一个 IF 语句
- 编译我的第一个c++程序时遇到问题
- 编译我的第一个C++程序时遇到问题
- C++程序仅执行第一个"if"语句
- 使用 SAPI.H - 为什么我的程序只说第一个词
- 第一个C++程序帮助(计算器)
- 第一个C++程序出现错误
- 编译第一个OpenGL红皮书程序(triangle .cpp)
- 问题与我的第一个CPP程序-头和源
- 我的第一个c++程序
- 第一个OpenGL程序从红皮书在Mac OS Cocoa NSOpenGLView
- 无法在visual c++ 2010中运行我的第一个Win32应用程序