修改使用autoconf创建的生成文件
Modify makefile created using autoconf
我正在使用autoconf
为使用gtkmm-3.0
的应用程序创建Makefile
。configure
脚本运行正常,生成了makefile。但是makefile将对象文件放在库之后,如下所示:
g++ -g -O2 -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0 -o base base-base.o
它给出以下错误:
/usr/include/gtkmm-3.0/gtkmm/papersize.h:45: undefined reference to `Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:45: undefined reference to `Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:46: undefined reference to `Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:46: undefined reference to `Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:47: undefined reference to `Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:47: undefined reference to `Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:48: undefined reference to `Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:48: undefined reference to `Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:49: undefined reference to `Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:49: undefined reference to `Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:50: undefined reference to `Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:50: undefined reference to `Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:51: undefined reference to `Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:51: undefined reference to `Glib::ustring::~ustring()'
base-base.o: In function `main':
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:7: undefined reference to `Glib::ustring::ustring(char const*)'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:7: undefined reference to `Gtk::Application::create(int&, char**&, Glib::ustring const&, Gio::ApplicationFlags)'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:7: undefined reference to `Glib::ustring::~ustring()'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:9: undefined reference to `Gtk::Window::Window(Gtk::WindowType)'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:10: undefined reference to `Gtk::Window::set_default_size(int, int)'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:12: undefined reference to `Gtk::Application::run(Gtk::Window&)'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:9: undefined reference to `Gtk::Window::~Window()'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:13: undefined reference to `Glib::ustring::~ustring()'
/home/shashwat001/Documents/UbuntuApps/gtkmmApps/FirstApp/src/base.cpp:9: undefined reference to `Gtk::Window::~Window()'
但是,当我手动使用库之前的对象文件运行上述语句时:
g++ -g -O2 -o base base-base.o -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lgtk-3 -lglibmm-2.4 -lcairomm-1.0 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lsigc-2.0 -lgobject-2.0 -lglib-2.0
这样就不会出现错误。所以问题在于库和对象文件的顺序。在autoconf
脚本中修改什么来在Makefile中推送订单更改?
在autoconf脚本中修改什么来推送Makefile中的订单更改?
如果只使用autoconf(不使用automake),则需要修改扩展名为".in"的文件,如Makefile.in,然后重新运行"./configure"。
如果你也使用automake,而不是Makefile.in,你必须编辑Makefile.am。然后运行autoreconf&/配置
相关文章:
- 终端不会为C++文件创建.exe文件吗
- 如何从具有两列的.txt文件创建并行数组?
- 从 .lib 文件创建一个.dll文件
- 如何从输入文件 c++ 创建随机名称生成器
- 无法从 cso 文件创建顶点着色器(从 fx 文件创建)
- 如何为多个目录中的多个文件创建生成文件?
- 在编译时从 c++ 文件创建枚举
- 如何在运行时从 c++ 中的 DLL 文件创建对象?
- 文件创建并不总是成功
- 如何使用 QFile、c++ 从文件创建整数数组
- 您可以使用 makefile 从 .o 对象文件创建 C++ 文件吗?
- 从函数中的dat文件创建一个2维数组
- 如何为 cpp 和 h 文件创建别名(并忽略编译器__attributes__)
- 如何从现有的生成文件创建 CMake 文件?
- 为什么我无法使用文本文件创建文件映射?
- 通过读取文件创建映射<字符串,矢量>时如何管理内存<string>
- 从文本文件创建 2D 字符串矢量
- ofStream: - 尽管文件创建了,但文本文件上没有输出
- 从语言文件创建JSON对象
- 将文本文件创建到节点.js的插件C++