int16_t me16; //me16 is a 16-bit signed variable
me16 = 4593;
printf("First, assume int16_t is short: ");
printf("me16 = %hd\n", me16);
printf("Next, we make no assumptions, but use a \"macro\" from inttypes.h: ");
printf("me16 = %" PRId16 "\n", me16);
well... there is a parse error... on line 14... apparently... you are reading something wrong... or the headers aren't doing something you that is assumed... anyway... the PRId16 is not being defined as "d"... either you can define it yourself or comment out the if block that is keeping it from being defined... or... maybe someone else has a better idea...
Zero Valintine
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I type the following program in, I get the error that "14 C:\....\Portable Types.cpp
parse error before string constant ":
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
int main()
{
int16_t me16; //me16 is a 16-bit signed variable
me16 = 4593;
printf("First, assume int16_t is short: ");
printf("me16 = %hd\n", me16);
printf("Next, we make no assumptions, but use a \"macro\" from inttypes.h: ");
printf("me16 = %" PRId16 "\n", me16);
system("PAUSE");
return 0;
}
However, if I only type in:
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
int main()
{
int16_t me16; //me16 is a 16-bit signed variable
me16 = 4593;
printf("First, assume int16_t is short: ");
printf("me16 = %hd\n", me16);
system("PAUSE");
return 0;
}
I get no errors and DevCpp compiles a perfectly usable program. I'm treating both as C++ programs, and using the new MinGW 3.2 compiler.
What's going on?
TIA,
anon
well... there is a parse error... on line 14... apparently... you are reading something wrong... or the headers aren't doing something you that is assumed... anyway... the PRId16 is not being defined as "d"... either you can define it yourself or comment out the if block that is keeping it from being defined... or... maybe someone else has a better idea...
Zero Valintine