我将 FLTK 从 1.1 更新到 1.3,然后我无法编译更新前运行良好的代码。
\n\n...\n [100%] Building CXX object CMakeFiles/PROSTVIEW.dir/include/nifti/vtkznzlib.cxx.o\n Linking CXX executable PROSTVIEW\n /usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fontopen(char const*, int, bool, int)\':\n fl_font.cxx:(.text+0x298): undefined reference to `FcPatternCreate\'\n fl_font.cxx:(.text+0x362): undefined reference to `FcPatternAddString\'\n fl_font.cxx:(.text+0x3e3): undefined reference to `FcPatternAddString\'\n fl_font.cxx:(.text+0x3f7): undefined reference to `FcPatternAddInteger\'\n fl_font.cxx:(.text+0x40b): undefined reference to `FcPatternAddInteger\'\n fl_font.cxx:(.text+0x424): undefined reference to `FcPatternAddDouble\'\n fl_font.cxx:(.text+0x43c): undefined reference to `FcPatternAddString\'\n fl_font.cxx:(.text+0x4df): undefined reference to `FcMatrixRotate\'\n fl_font.cxx:(.text+0x4f7): undefined reference to `FcPatternAddMatrix\'\n fl_font.cxx:(.text+0x516): undefined reference to `FcPatternAddBool\'\n fl_font.cxx:(.text+0x52c): undefined reference to `FcPatternAddBool\'\n …
Run Code Online (Sandbox Code Playgroud) 我一直在尝试以fltk
几种不同的方式构建Windows,但我总是最终:
configure:错误:C编译器无法创建可执行文件(msys fltk/configure)
要么
检查工作C编译器:C:/MinGW/bin/gcc.exe - 破解(CMake-gui)
我已经试过了fltk 1.3.0
,1.3.3
而且我甚至使用了三种不同的MinGW发行版,GCC
版本:5.1.0
; 4.9.2
和3.4.5
.但它不会编译.以下是./configure文件生成的一些错误日志:
$ ./configure --prefix = C:/libs/fltk-1.3.3
-----------
核心测试.
-----------
configure:1336:检查构建系统类型configure:1354:result:i686-pc-mingw32 configure:1362:检查主机系统类型configure:1376:result:i686-pc-mingw32 configure:1439:检查gcc configure:1455:found/c/mingw32/bin/gcc configure:1465:结果:gcc configure:1709:检查C编译器版本configure:1712:gcc --version&5 gcc.exe(i686-win32-dwarf-rev2,由MinGW-W64构建项目)4.9.2版权所有(C)2014 Free Software Foundation,Inc.这是免费软件; 查看复制条件的来源.没有保修; 甚至不适用于适销性或特定用途的适用性.
配置:1715:$?= 0 configure:1717:gcc -v&5使用内置规范.COLLECT_GCC = c:\ mingw32\bin\gcc.exe COLLECT_LTO_WRAPPER = c:/ mingw32/bin /../ libexec/gcc/i686-w64-mingw32/4.9.2/lto-wrapper.exe目标:i686-w64-mingw32配置:../../../src/gcc-4.9.2/configure --host = i686-w64-mingw32 --build = i686-w64-mingw32 --target = i686-w64-mingw32 - prefix =/mingw32 --with-sysroot =/c/mingw492/i686-492-win32-dwarf-rt_v4-rev2/mingw32 --with-gxx-include-dir =/mingw32/i686-w64-mingw32/include/c ++ --enable-shared --enable-static --disable-multilib --enable-languages = ada,c,c …
在 macOS 上,使用英文键盘时,组合键CMD+Backtick
用于循环浏览应用程序打开的窗口。例如,在德语键盘上,组合是CMD+<
. 甚至可以使用System Preferences
-> Keyboard
-> Shortcuts
-> Keyboard
->配置此快捷方式Move focus to next window
。
对于使用 FLTK 的多窗口 GUI 应用程序,我想利用此快捷方式,但不知道如何获取用户在其系统上设置的组合。所以我正在寻找一个 macOS 系统调用,它可以为我提供Move focus to next window
在这台 Mac 上使用的组合键。
当然,如果有一种使用 FLTK 的内置方式,我会更喜欢这种方式,而不是使用本机系统调用。
\n\n谷歌搜索这个问题是一场噩梦......
\n\n2017年8月10日更新\n\xc3\x96\xc3\xb6\的答案给了我一些额外研究的想法。从那以后我了解到首选项存储在 中com.apple.symbolichotkeys
,更准确地说是存储在键 27 中。
27 = {\n enabled = 1;\n value = {\n parameters = (\n 98,\n 11,\n 524288\n );\n type = standard;\n };\n };\n
Run Code Online (Sandbox Code Playgroud)\n\n参数 1 …
我正在做一个学校项目必须采用一种GUI形式.可悲的是,我没有使用任何GUI的经验,所以我只花了最后几个小时比较各种工具包,并确定了它的轻量级FLTK.我还花时间尝试通过阅读各种指南来安装FLTK,但无济于事.
我想知道是否有人能告诉我一步一步做什么.提前致谢
顺便说一下,我在Windows 7中使用Visual Studio 2010 Professional
我正在使用 FLTK。我有一个带有各种按钮的窗口,用户可以单击来执行某些操作。在我的 int main() 中,我有一个 switch 语句来处理所有这些。当用户单击退出时, switch 语句设置如下:
case Exit_program:
cout << "save files and exit\n";
do_save_exit(sw);
Run Code Online (Sandbox Code Playgroud)
这将转到 do_save_exit 函数,该函数创建一个退出确认窗口,其中包含两个按钮 yes(退出)和 no(不退出)。我按下“是”按钮即可工作,退出程序,但“否”按钮意味着我应该隐藏确认窗口。这是以下功能:
void yes(Address addr, Address)
{
exit(0);
}
void no(Address addr, Address)
{
}
void do_save_exit(Window& w)
{
Window quit(Point(w.x()+100, w.y()+100), 250, 55, "Exit confirmation");
Text conf(Point(15,15),"Do you really want to save and exit?");
Button yes(Point(60, 20),35,30,"Yes",yes);
Button no(Point(140, 20),35,30,"No",no);
quit.attach(conf);
quit.attach(yes);
quit.attach(no);
wait_for_main_window_click();
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我单击“否”按钮时,它会变为“无效”,但我无法从那里去任何地方。我只想执行 quit.hide() 但 no 函数看不到退出窗口(超出范围)。我应该如何进行?谢谢
PS:我曾考虑过使用指向退出窗口的指针,然后使用该指针在 no 函数中退出窗口,但不确定如何准确执行此操作。
我已将 FL 文件夹复制到项目中。
它向我展示了这个:
1>------ 构建开始:项目:客户端,配置:调试 Win32 ------ 1> Main.cpp 1>c:\users\user\documents\visual studio 2012\projects\talktome\talktome \fl\xutf8.h(33):致命错误 C1083:无法打开包含文件:'X11/X.h':没有这样的文件或目录 ========== 构建:0 成功,1 失败, 0 最新,0 跳过 ==========
我的源代码是
using namespace std;
#include "FL\Fl.H"
#include "FL\Fl_Window.H"
#define WIDTH 700
#define HEIGHT 500
int main()
{
Fl_Window win(WIDTH, HEIGHT, "TalkToMe");
win.begin();
win.end();
win.show();
return Fl::run();
}
Run Code Online (Sandbox Code Playgroud) 我是C++的新手,在我的编程设计和概念类简介中,我们现在使用的是图形.我已经能够使与公正程序FLTK的库,但我们不得不使用了Bjarne的图书馆,如GUI.h
,Graph.h
,Simple_window.h
,Point.h
.像简单窗口程序这样的简单程序将无法编译并提供通常的响应:
Simple_window.h:17: error: reference to ‘Window’ is ambiguous
Run Code Online (Sandbox Code Playgroud)
我也尝试使用以下编译:
fltk-config --compile main.cpp
Run Code Online (Sandbox Code Playgroud)
这产生相同的结果.
我已经尝试运行Bjarne在文件夹中提供的make文件,但总是会出现错误并且没有.o
文件.
注意:我也尝试在mac OSX和Ubuntu上进行编译.
MainWindow::MainWindow(int w, int h, const string& c)
: Fl_Window(w, h, c.c_str()) // Don't call constructor over here
{
script.load_file(WIN_CONFIG_SCRIPT);
int width = script.get_global_int("width");
int height = script.get_global_int("height");
const char* caption = script.get_global_string("caption").c_str();
/** CALL CONSTRUCTOR NOW **/
//NOTE: I don't know a way to change an FLTK Fl_Window's Caption after
//initialising it.
Toolbar* toolbar = new Toolbar(0, 0, this->w(),30);
toolbar->add_button("Hello");
toolbar->add_button("World!");
end();
}
Run Code Online (Sandbox Code Playgroud)
如何初始化基类中的构造?或者,如何在初始化后更改FLTK Fl_Window的标题?这个烂摊子还有其他方法吗?
我正在制作一个简单的 FLTK 应用程序(在 Windows 中),需要在 FL_Window 中显示 PNG 图像,从磁盘一个接一个地加载它们。我将此代码作为起点,但它没有显示图像,我可以确认该图像与可执行文件位于同一文件夹中:
int main(int argc, char **argv)
{
Fl_Window *main_window = NULL;
fl_register_images();
flw = new Fl_Window(1680,1050,title);
Fl_Shared_Image *a = Fl_Shared_Image::get("picture.png");
if (a != NULL)
{
cout << "Image loaded" << endl;
}
else
{
cout << "No image loaded" << endl; // <==== This is printed
}
flw->begin();
// add image to window code here, not sure what to write but
// image doesnt even load
flw->end();
main_window->show();
int fl_ret = Fl::run(); …
Run Code Online (Sandbox Code Playgroud) 为什么我无法调整窗口大小一次window.size()
或被window.resize()
调用?如何解决这个问题?
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
int main(int argc, char** argv) {
Fl_Window window(0, 0, 110, 110);
window.position(0, 0);
// window.size(300, 300); <--uncomment this, and cannot resize window with the mouse!
window.show(argc,argv);
return Fl::run();
}
Run Code Online (Sandbox Code Playgroud) 我想用 fltk 创建一个自定义对话框窗口。我将放置小部件。后台进程应等待对话框完成。我找不到任何这方面的例子。我正在寻找 fl_input 函数。我找到了 makeform() 函数,但它没有多大帮助。
最近我尝试了FLTK。编译源代码后,我想使用 FLTK 创建一个小型应用程序。
然而,在我尝试编译之后,g++ 说:
C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x298): 对“__imp_ExtCreateRegion”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x2c4): 对“__imp_CombineRgn”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x2d4): 对“__imp_DeleteObject”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x351): 对“__imp_ExtCreateRegion”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x37d): 对“__imp_CombineRgn”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(Fl_Window_shape.cxx.obj):Fl_Window_shape.cxx:(.text+0x38d): 对“__imp_DeleteObject”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0x65): 对“__imp_DeleteObject”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0x9f): 对“__imp_CreatePen”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0xc3): 对“__imp_SelectObject”的未定义引用 C:\Program Files (x86)\FLTK\lib/libfltk.a(fl_color.cxx.obj):fl_color.cxx:(.text+0x102): 对“__imp_SelectObject”的未定义引用
还有更多。我发现这个ExtCreateRegion
和其他提到的功能都在windgi.h
. 那么,我应该链接到哪个静态库?
代码:
fltk::frame::Frame::new(0,0, 300, 100, format!("side item {}", i));
Run Code Online (Sandbox Code Playgroud)
输出错误:
the trait `std::convert::From<std::string::String>` is not implemented for `std::option::Option<&'static str>`
Run Code Online (Sandbox Code Playgroud)