Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: 'uint16_t' undeclared?

I have the code

#include <emmintrin.h> #include <stdio.h>  void print128_num(__m128i var) {     uint16_t *val = (uint16_t*) &var;     printf("Numerical: %i %i %i %i %i %i %i %i \n",            val[0], val[1], val[2], val[3], val[4], val[5],            val[6], val[7]); } int main(void) {     __m128i a = _mm_set_epi32(4, 3, 2, 1);     __m128i b = _mm_set_epi32(7, 6, 5, 4);     __m128i c = _mm_add_epi32(a, b);      print128_num(c);      return 0; } 

and I'm getting an error where uint16_t isn't declared. I'm using GCC with MINGW.

Heres the complete error.

||In function 'print128_num':| |6|error: 'uint16_t' undeclared (first use in this function)| |6|error: (Each undeclared identifier is reported only once| |6|error: for each function it appears in.)| |6|error: 'val' undeclared (first use in this function)| |6|error: expected expression before ')' token| 
like image 514
pandoragami Avatar asked Jul 02 '13 21:07

pandoragami


1 Answers

You need to include stdint.h or inttypes.h to get uint16_t.

like image 99
Carl Norum Avatar answered Oct 03 '22 09:10

Carl Norum