You need to use the gcc command line option: -mlzcnt
undefined reference to `__lzcnt16?
-
03-06-2022 - |
Question
I have this code which I'm trying to run with GCC-TDM 1.7.4-2 using -msse4.2
(I tried msse4
) with an error:
sse_lzcnt.c|7|warning: implicit declaration of function '__lzcnt16'|
sse_lzcnt.c|9|warning: too many arguments for format|
obj\Debug\sse_lzcnt.o||In function `main':|
sse_lzcnt.c|7|undefined reference to `__lzcnt16'|
An undefined reference is usually a linking error due to a missing lib file (.a ending) but the intrinsics headers don't need one?
I made sure the intrinsics headers are in the correct include directory. Heres the code,
#include <x86intrin.h>
#include <stdio.h>
int main()
{
unsigned short __X = 256;
unsigned short RESULT = __lzcnt16(__X);
printf("result: ", RESULT);
return 0;
}
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow