0

コンシューマー/プロデューサーがどのように機能するかを示すMLT フレームワーク Web サイトからサンプル コードをコンパイルしようとしています。コードは次のとおりです。

#include <stdio.h>
#include <unistd.h>
#include <framework/mlt.h>

int main( int argc, char *argv[] )
{
    // Initialise the factory
    if ( mlt_factory_init( NULL ) == 0 )
    {
        // Create the default consumer
        mlt_consumer hello = mlt_factory_consumer( NULL, NULL );

        // Create via the default producer
        mlt_producer world = mlt_factory_producer( NULL, argv[ 1 ] );

        // Connect the producer to the consumer
        mlt_consumer_connect( hello, mlt_producer_service( world ) );

        // Start the consumer
        mlt_consumer_start( hello );

        // Wait for the consumer to terminate
        while( !mlt_consumer_is_stopped( hello ) )
            sleep( 1 );

        // Close the consumer
        mlt_consumer_close( hello );

        // Close the producer
        mlt_producer_close( world );

        // Close the factory
        mlt_factory_close( );
    }
    else
    {
        // Report an error during initialisation
        fprintf( stderr, "Unable to locate factory modules\n" );
    }

    // End of program
    return 0;
}

ファイル名は player.c です。インクルードファイルが見つからないため、
makeを使用してコンパイルすることはできません。make player

次のコマンドを使用して gcc でコンパイルしています。

 # gcc -I /usr/include/mlt -l libmltcore -o player player.c 
/usr/bin/ld: cannot find -llibmltcore
collect2: error: ld returned 1 exit status

ご覧のとおり、リンカは mlt ライブラリを見つけることができません。OS は Fedora 32 で、mlt-devel をインストールしました。/usr/lib64/mlt に次のライブラリがあると確信しています。

libmltavformat.so  libmltlinsys.so      libmltqt.so         libmltvidstab.so
libmltcore.so      libmltmotion_est.so  libmltresample.so   libmltvmfx.so
libmltdecklink.so  libmltnormalize.so   libmltrtaudio.so    libmltvorbis.so
libmltfrei0r.so    libmltoldfilm.so     libmltsdl2.so       libmltxml.so
libmltgtk2.so      libmltopengl.so      libmltsdl.so
libmltjackrack.so  libmltplusgpl.so     libmltsox.so
libmltkdenlive.so  libmltplus.so        libmltvideostab.so

私は何を間違っていますか?

2 番目の質問は、GCC がインクルード ファイルとライブラリを最初から見つけられず、手動で指定する必要があるのはなぜですか?

4

1 に答える 1