MikeZ
MikeZ

Reputation: 33

Can't link a simple "hellow world" with Simd Library

I'm trying to compile a simple code wich calls one function of Simd Library:

// 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 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

Subdirectory ./Simd contains 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 I tried to find the required function in the library files:

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

I realize that my question is rather silly, but I will be glad to any your advice to help me link that correctly.

Upvotes: 3

Views: 243

Answers (1)

Akira
Akira

Reputation: 213

I have built your example with using of the following options:

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

Upvotes: 2

Related Questions