静态链接与升压和ncurses的 [英] Static linking with Boost and ncurses
问题描述
我在制备基本角色扮演游戏的进程。我想包括Boost库静态地让谁运行我的游戏人并不需要他们。我研究并期待向上,所有你需要做的就是添加 -static
来的命令行编译,所以我的命令是这样的:
I am in the process of making a basic role-playing game. I want to include the Boost libraries statically so that the people who run my game do not need to have them. I researched and looked-up that all you have to do is add -static
to the command-line compile, so my command is like this:
$ g++ -static -o karthas *.o -lncurses -lmenu -lboost_system -lboost_filesystem
但显然 -static
是影响ncurses的。我得到了一大堆错误,其中大部分是未定义引用SP的。
But apparently the -static
is affecting ncurses. I am getting a whole bunch of errors, most of which are undefined reference to 'SP'.
是否有可能只是做一个静态链接,以提高而不是ncurses的?我会如何做呢?
Is it possible to just do a static link to Boost and not ncurses? How would I go about doing that?
推荐答案
您可以选择哪些库将静态链接和动态将通过把两种轮候册,-static $ C链接$ C>或<前code>轮候册,-Bdynamic
他们的名字。
You can choose which libraries will be linked statically and which will be linked dynamically by putting either -Wl,-static
or -Wl,-Bdynamic
before their name.
例如有:
g++ -o karthas *.o -Wl,-static -lmenu -lboost_system -lboost_filesystem -Wl,-Bdynamic -lncurses
菜单,boost_system和boost_filesystem库将静态链接和动态的ncurses
The menu, boost_system and boost_filesystem libraries will be linked statically and ncurses dynamically.
(但你也可以用你的可执行文件分发升压的dll,而不是静态链接任何东西)。
(But you can also distribute the boost dlls with your executable, and not link anything statically).
这篇关于静态链接与升压和ncurses的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!