Adding object (.o) files to qtcreator project

会有一股神秘感。 提交于 2019-12-01 21:40:37

Based on your comment discussion, you seem to have at least two issues ongoing:

1) You need to use the OBJECTS variable in qmake to have the operation you have with the -o argument of gcc. Here you can find the documentation of it:

OBJECTS

This variable is automatically populated from the SOURCES variable. The extension of each source file is replaced by .o (Unix) or .obj (Win32). You can add objects to the list.

Based on this, you would be writing something like this:

OBJECTS += common.o MD5_std.o

Note that you will also need to use "extern C" linkage specification to avoid the name mangling. That is necessary to be able to link when using your third-party object coming from C code and such compilation. You would need to be writing this for your corresponding C functions:

extern "C"
{
    ...
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!