Adding object (.o) files to qtcreator project

后端 未结 1 1894
难免孤独
难免孤独 2021-01-20 05:50

How does one add third party .o and .h files to a Qt C++ project in QtCreator? I want to add some compiled .o files from John The Ripper to my probject (ignore the non-cross

1条回答
  •  [愿得一人]
    2021-01-20 06:35

    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"
    {
        ...
    }
    

    0 讨论(0)
提交回复
热议问题