gpt4 book ai didi

linux - 不与 MinGW 交叉编译的简单 Fltk 应用程序

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:31:22 24 4
gpt4 key购买 nike

我正在尝试在 Linux 上进行交叉编译以创建适用于 32 位 Windows 的 exe 文件。我使用以下代码:

i686-w64-mingw32-g++ rnfltk_simplest.cpp -static-libgcc -static-libstdc++ -o rnfltk_simplest.exe -lfltk -I/usr/include/

但我得到的输出有很多错误:

In file included from /usr/share/mingw-w64/include/winsock.h:32:0,
from /usr/share/mingw-w64/include/windows.h:92,
from /usr/include/Fl/Fl_Window.H:26,
from rnfltk_simplest.cpp:4:
/usr/share/mingw-w64/include/_timeval.h:10:8: error: redefinition of ‘struct timeval’
struct timeval
^~~~~~~
In file included from /usr/include/sys/select.h:47:0,
from /usr/include/sys/types.h:219,
from /usr/include/stdlib.h:275,
from /usr/include/FL/fl_utf8.h:36,
from /usr/include/FL/Fl.H:32,
from rnfltk_simplest.cpp:2:
/usr/include/bits/time.h:30:8: error: previous definition of ‘struct timeval’
struct timeval
^~~~~~~
In file included from /usr/share/mingw-w64/include/winsock.h:36:0,
from /usr/share/mingw-w64/include/windows.h:92,
from /usr/include/Fl/Fl_Window.H:26,
from rnfltk_simplest.cpp:4:
/usr/share/mingw-w64/include/psdk_inc/_fd_types.h:21:16: error: using typedef-name ‘fd_set’ after ‘struct’
typedef struct fd_set
^~~~~~
In file included from /usr/include/sys/types.h:219:0,
from /usr/include/stdlib.h:275,
from /usr/include/FL/fl_utf8.h:36,
from /usr/include/FL/Fl.H:32,
from rnfltk_simplest.cpp:2:
/usr/include/sys/select.h:77:5: note: ‘fd_set’ has a previous declaration here
} fd_set;
^~~~~~
In file included from /usr/share/mingw-w64/include/winsock.h:36:0,
from /usr/share/mingw-w64/include/windows.h:92,
from /usr/include/Fl/Fl_Window.H:26,
from rnfltk_simplest.cpp:4:
/usr/share/mingw-w64/include/psdk_inc/_fd_types.h:25:3: error: conflicting declaration ‘typedef int fd_set’
} fd_set;
^~~~~~
In file included from /usr/include/sys/types.h:219:0,
from /usr/include/stdlib.h:275,
from /usr/include/FL/fl_utf8.h:36,
from /usr/include/FL/Fl.H:32,
from rnfltk_simplest.cpp:2:
/usr/include/sys/select.h:77:5: note: previous declaration as ‘typedef struct fd_set fd_set’
} fd_set;
^~~~~~
In file included from /usr/share/mingw-w64/include/winsock.h:36:0,
from /usr/share/mingw-w64/include/windows.h:92,
from /usr/include/Fl/Fl_Window.H:26,
from rnfltk_simplest.cpp:4:
/usr/share/mingw-w64/include/psdk_inc/_fd_types.h:104:16: error: using typedef-name ‘fd_set’ after ‘struct’
typedef struct fd_set FD_SET;
^~~~~~
In file included from /usr/include/sys/types.h:219:0,
from /usr/include/stdlib.h:275,
from /usr/include/FL/fl_utf8.h:36,
from /usr/include/FL/Fl.H:32,
from rnfltk_simplest.cpp:2:
/usr/include/sys/select.h:77:5: note: ‘fd_set’ has a previous declaration here
} fd_set;
^~~~~~
In file included from /usr/share/mingw-w64/include/winsock.h:36:0,
from /usr/share/mingw-w64/include/windows.h:92,
from /usr/include/Fl/Fl_Window.H:26,
from rnfltk_simplest.cpp:4:
/usr/share/mingw-w64/include/psdk_inc/_fd_types.h:105:16: error: using typedef-name ‘fd_set’ after ‘struct’
typedef struct fd_set *PFD_SET;
^~~~~~
In file included from /usr/include/sys/types.h:219:0,
from /usr/include/stdlib.h:275,
from /usr/include/FL/fl_utf8.h:36,
from /usr/include/FL/Fl.H:32,
from rnfltk_simplest.cpp:2:
/usr/include/sys/select.h:77:5: note: ‘fd_set’ has a previous declaration here
} fd_set;
^~~~~~
In file included from /usr/share/mingw-w64/include/winsock.h:36:0,
from /usr/share/mingw-w64/include/windows.h:92,
from /usr/include/Fl/Fl_Window.H:26,
from rnfltk_simplest.cpp:4:
/usr/share/mingw-w64/include/psdk_inc/_fd_types.h:106:16: error: using typedef-name ‘fd_set’ after ‘struct’
typedef struct fd_set *LPFD_SET;
^~~~~~
In file included from /usr/include/sys/types.h:219:0,
from /usr/include/stdlib.h:275,
from /usr/include/FL/fl_utf8.h:36,
from /usr/include/FL/Fl.H:32,
from rnfltk_simplest.cpp:2:
/usr/include/sys/select.h:77:5: note: ‘fd_set’ has a previous declaration here
} fd_set;
^~~~~~
In file included from /usr/share/mingw-w64/include/windows.h:92:0,
from /usr/include/Fl/Fl_Window.H:26,
from rnfltk_simplest.cpp:4:
/usr/share/mingw-w64/include/winsock.h:299:34: error: conflicting declaration of C function ‘int select(int, fd_set*, fd_set*, fd_set*, PTIMEVAL)’
WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
^~~~~~
In file included from /usr/include/sys/types.h:219:0,
from /usr/include/stdlib.h:275,
from /usr/include/FL/fl_utf8.h:36,
from /usr/include/FL/Fl.H:32,
from rnfltk_simplest.cpp:2:
/usr/include/sys/select.h:108:12: note: previous declaration ‘int select(int, fd_set*, fd_set*, fd_set*, timeval*)’
extern int select (int __nfds, fd_set *__restrict __readfds,
^~~~~~

问题出在哪里,如何解决?感谢您的帮助。

最佳答案

问题出在

-I/usr/include/

此路径包含为您的 Linux 系统配置和安装的库的 header 。但是您想使用特定于 Windows 库的 header 。这些安装在 MinGW 编译器“系统”包含目录中(很可能是 /usr/share/mingw-w64/include,因为所有的冲突都来自那里)。

您需要将 Fltk 安装到您的 MinGW 中。例如,在 openSUSE 中,这将是包 mingw64-fltk-devel

关于linux - 不与 MinGW 交叉编译的简单 Fltk 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58067077/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com