无法在Mingw上制作fltk [英] Not able to make fltk on Mingw

查看:257
本文介绍了无法在Mingw上制作fltk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows10的Mingw-32位中安装fltk. 我从此处下载fltk-1.3.5,将其解压缩,cd到文件夹并运行命令make来构建它.但这给了我以下错误:

I am trying to install fltk in Mingw-32 bit on Windows10. I download fltk-1.3.5 from here, unzipped it, cd to folder and run command make to build it. But it gives me following error:

$ make
=== making jpeg ===
=== making zlib ===
=== making png ===
=== making src ===
=== making fluid ===
Compiling ExternalCodeEditor_WIN32.cxx...
ExternalCodeEditor_WIN32.cxx: In function ‘const char* get_ms_errmsg()’:
ExternalCodeEditor_WIN32.cxx:37:5: error: ‘_snprintf’ was not declared in this scope; did you mean ‘asnprintf’?
   37 |     _snprintf(emsg, sizeof(emsg), "Error Code %ld", long(lastErr));
      |     ^~~~~~~~~
      |     asnprintf
ExternalCodeEditor_WIN32.cxx: In function ‘int terminate_app(DWORD, DWORD)’:
ExternalCodeEditor_WIN32.cxx:116:60: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘DWORD’ {aka ‘unsigned int’} [-Wformat=]
  116 |       printf("WARNING: sent WIN_CLOSE, but timeout after %ld msecs.."
      |                                                          ~~^
      |                                                            |
      |                                                            long int
      |                                                          %d
  117 |              "trying TerminateProcess\n", msecTimeout);
      |                                           ~~~~~~~~~~~
      |                                           |
      |                                           DWORD {aka unsigned int}
ExternalCodeEditor_WIN32.cxx: In static member function ‘static const char* ExternalCodeEditor::tmpdir_name()’:
ExternalCodeEditor_WIN32.cxx:299:3: error: ‘_snprintf’ was not declared in this scope; did you mean ‘asnprintf’?
  299 |   _snprintf(dirname, sizeof(dirname), "%s.fluid-%ld",
      |   ^~~~~~~~~
      |   asnprintf
ExternalCodeEditor_WIN32.cxx: In member function ‘const char* ExternalCodeEditor::tmp_filename()’:
ExternalCodeEditor_WIN32.cxx:343:3: error: ‘_snprintf’ was not declared in this scope; did you mean ‘asnprintf’?
  343 |   _snprintf(path, sizeof(path), "%s\\%p%s", tmpdir, (void*)this, ext);
      |   ^~~~~~~~~
      |   asnprintf
ExternalCodeEditor_WIN32.cxx: In member function ‘int ExternalCodeEditor::start_editor(const char*, const char*)’:
ExternalCodeEditor_WIN32.cxx:422:3: error: ‘_snprintf’ was not declared in this scope; did you mean ‘asnprintf’?
  422 |   _snprintf(cmd, sizeof(cmd), "%s %s", editor_cmd, filename);
      |   ^~~~~~~~~
      |   asnprintf
make[1]: *** [../makeinclude:162: ExternalCodeEditor_WIN32.o] Error 1
make: *** [Makefile:24: all] Error 1

Mingw-64位出现类似错误.

Similar error occurs on Mingw-64 bit.

问题出在哪里,如何解决?

Where is the problem and how can it be solved?

我尝试了@jacob在他的回答中给出的方法,但出现以下错误:

I tried method given by @jacob in his answer but got following error:

$ cmake -G "MinGW Makefiles" -D CMAKE_MAKE_PROGRAM=mingw32-make ..
CMake Error: Could not create named generator MinGW Makefiles

Generators
* Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

推荐答案

我能够在MSYS2中使用MinGW-w64(64位)编译Fltk 1.3.5,而没有一个警告.我这样进行:

I was able to compile Fltk 1.3.5 with MinGW-w64 (64 bit) in MSYS2, without a single warning. I proceeded like this:

tar xvf fltk-1.3.5-source.tar.bz2
cd fltk-1.3.5
mkdir build
cd build
cmake -G "MinGW Makefiles" -D CMAKE_MAKE_PROGRAM=mingw32-make ..
mingw32-make

除了编译器本身之外,关键软件包还包括mingw64/mingw-w64-x86_64-cmakemingw64/mingw-w64-x86_64-make.

Aside from the compiler itself, the key packages were mingw64/mingw-w64-x86_64-cmake and mingw64/mingw-w64-x86_64-make.

这篇关于无法在Mingw上制作fltk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆