I’m working on a new filter to make a graphical part to the gps text one but I’m now stuck on one probably cmake-related thing and can’t figure it out with google:
I made the filter_gpsgraphic.cpp in the \src\modules\qt folder which with basic code compiles ok (I’m using cmake with ninja). But when trying to include and re-use the gps parsing function from the \src\modules\xml folder I get “undefined reference” errors to all the functions declared in gps_parser.h defined in the gps_parser.c.
In my .cpp I did #include "../xml/gps_parser.h"
to include the header – Is this correct/preferred? Or should I change the makefile to link to the xml folder directly? (how do I do this?)
The gps_parser.h is found and parsed by cmake as I had some errors regarding the libxml inside that I fixed by adding this line PkgConfig::xml
to the CMakeList in the qt folder (under the target_link_libraries() call). – is this ok? Or should I somehow include it indirectly from the xml folder/mltxml.lib?
But it seems that it doesn’t find the gps_parser.c objects so at this point I think I should link from the QT to the XML folder (or the resulting mltxml library) somehow using the CMakeList but I have no idea how. I tried adding mlt mltxml xml and some other combinations of this in the same target_link_libraries
but I still get this output when building:
$ cmake --build .
[1/3] Automatic MOC for target mltqt
[2/2] Linking CXX shared module out\lib\mlt\libmltqt.dll
FAILED: out/lib/mlt/libmltqt.dll
cmd.exe /C "cd . && C:\Qt\Tools\mingw810_64\bin\g++.exe -Ic:/Projects/Shotcut/include -DHAVE_STRUCT_TIMESPEC -Lc:/Projects/Shotcut/lib -Lc:/Projects/Shotcut -shared -o out\lib\mlt\libmltqt.dll -Wl,--major-image-version,0,--minor-image-version,0 src/modules/qt/CMakeFiles/mltqt.dir/mltqt_autogen/mocs_compilation.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/factory.c.obj src/modules/qt/CMakeFiles/mltqt.dir/producer_qimage.c.obj src/modules/qt/CMakeFiles/mltqt.dir/producer_kdenlivetitle.c.obj src/modules/qt/CMakeFiles/mltqt.dir/common.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/graph.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/qimage_wrapper.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/kdenlivetitle_wrapper.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/filter_audiolevelgraph.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/filter_audiowaveform.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/filter_qtext.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/filter_qtblend.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/filter_qtcrop.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/producer_qtext.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/transition_qtblend.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/consumer_qglsl.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/filter_typewriter.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/typewriter.cpp.obj src/modules/qt/CMakeFiles/mltqt.dir/transition_vqm.cpp.obj out/lib/libmlt++-7.dll.a out/lib/libmlt-7.dll.a -lm C:/Qt/5.15.2/mingw81_64/lib/libQt5Xml.a C:/Qt/5.15.2/mingw81_64/lib/libQt5Svg.a C:/Qt/5.15.2/mingw81_64/lib/libQt5Widgets.a C:/Qt/5.15.2/mingw81_64/lib/libQt5Gui.a C:/msys64_v2/mingw64/lib/libxml2.dll.a C:/Qt/5.15.2/mingw81_64/lib/libQt5Core.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x574): undefined reference to `binary_search_gps(gps_private_data, long long, char)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x63f): undefined reference to `binary_search_gps(gps_private_data, long long, char)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0xbb9): undefined reference to `binary_search_gps(gps_private_data, long long, char)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0xc84): undefined reference to `binary_search_gps(gps_private_data, long long, char)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x10fe): undefined reference to `datetimeXMLstring_to_mseconds(char const*, char*)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x11ad): undefined reference to `datetimeXMLstring_to_mseconds(char const*, char*)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x12a0): undefined reference to `mseconds_to_timestring(long long, char*, char*)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x12c2): undefined reference to `mseconds_to_timestring(long long, char*, char*)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x1385): undefined reference to `process_gps_smoothing(gps_private_data, char)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x1448): undefined reference to `recalculate_gps_data(gps_private_data)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x1491): undefined reference to `mseconds_to_timestring(long long, char*, char*)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x1776): undefined reference to `xml_parse_file(gps_private_data)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x1835): undefined reference to `get_first_gps_time(gps_private_data)'
src/modules/qt/CMakeFiles/mltqt.dir/filter_gpsgraphic.cpp.obj:filter_gpsgraphic.cpp:(.text+0x18e6): undefined reference to `get_last_gps_time(gps_private_data)'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Any ideas?