Can't link simple "hello world" to Simd library

I am trying to compile a simple code that calls a single Simd Library function:

// simd.c
#include <stdint.h>
#include "Simd/SimdLib.h"

int main(void) {

    uint8_t buf1[720*576];
    uint8_t buf2[900*720];

    SimdResizeBilinear(buf1, 720, 576, 720*1, buf2, 900, 720, 900*1, 1);

    return 0;
}

      

with the following command line:

gcc -I./ -L./Simd/ -lSimd simd.c -o simd
/tmp/cckOlRnm.o: In function `main':
simd.c:(.text+0x46): undefined reference to `SimdResizeBilinear'
collect2: error: ld returned 1 exit status

      

The ./simd subdirectory contains the following files:

ls -A1 ./Simd/
libSimd.a
libSimdAvx1.a
libSimdAvx2.a
libSimdBase.a
libSimdSse1.a
libSimdSse2.a
libSimdSse3.a
libSimdSse41.a
libSimdSse42.a
libSimdSsse3.a
SimdAvx1.h
SimdAvx2.h
SimdBase.h
SimdBase_tinyxml2.h
SimdCompare.h
SimdConfig.h
SimdConst.h
SimdConversion.h
SimdDefs.h
SimdDetection.h
SimdEnable.h
SimdExtract.h
SimdHelp.h
SimdInit.h
SimdLib.h
SimdLoad.h
SimdLog.h
SimdMath.h
SimdMemory.h
SimdNeon.h
SimdSet.h
SimdSse1.h
SimdSse2.h
SimdSse3.h
SimdSse41.h
SimdSse42.h
SimdSsse3.h
SimdStore.h
SimdStream.h
SimdVersion.h
SimdVmx.h
SimdVsx.h

      

I was surprised by the compiler message 'undefined reference' and tried to find the function I needed in the library files:

nm -o ./Simd/*.a | grep SimdResizeBilinear
Simd/libSimd.a:SimdLib.cpp.o:00005510 T SimdResizeBilinear

      

I realize my question is pretty stupid, but I would appreciate any advice from you to help me link this correctly.

+3


source to share


1 answer


I built your example using the following parameters:



gcc simd.c -I./ -L./Simd/ -o simd -lSimd -lSimdBase -lSimdSse1 -lSimdSse2 -lSimdSse3 -lSimdSsse3 -lSimdSse41 -lSimdSse42 -lSimdAvx1 -lSimdAvx2 -lstdc++ -lm

      

+1


source







All Articles