尝试在代码块中编译一个简单的 gtkmm 应用程序,但只是收到有关 ustring.h 文件的错误
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|861|error: ISO C++ forbids declaration of `wostringstream' with no type|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|861|error: expected `;' before "StreamType"|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|865|error: `StreamType' does not name a type|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|906|error: expected constructor, destructor, or type conversion before '&' token|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|906|error: expected `,' or `;' before '&' token|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|912|error: expected constructor, destructor, or type conversion before '&' token|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|912|error: expected `,' or `;' before '&' token|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h||In member function `void Glib::ustring::FormatStream::stream(const T&)':|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|1057|error: `stream_' undeclared (first use this function)|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|1057|error: (Each undeclared identifier is reported only once for each function it appears in.)|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h||In member function `void Glib::ustring::FormatStream::stream(const char*)':|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|1063|error: `stream_' undeclared (first use this function)|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h||In member function `void Glib::ustring::FormatStream::stream(char*)':|
C:\gtkmm\include\glibmm-2.4\glibmm\ustring.h|1069|error: `stream_' undeclared (first use this function)|
||=== Build finished: 11 errors, 0 warnings ===|
使用构建选项,我将
pkg-config --libs gtkmm-2.4
添加到链接器选项,将 pkg-config --cflags gtkmm-2.4
添加到编译器 -> 其他选项。
我使用的代码是一个简单的例子
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app =
Gtk::Application::create(argc, argv,
"org.gtkmm.examples.base");
Gtk::ApplicationWindow window;
return app->run(window);
}
任何帮助将不胜感激,我正在运行 win7 x64
如果你想使用
Gtk::Application
等,你至少需要使用gtkmm-3.4。 应用程序是 gtk 3.x 类,直到 gtkmm-3.4 才正确包装。