I am having trouble compiling some very simple C++ code on my Raspberry Pi B+. I wrote the following program in a file called test.cpp
#include <stdio.h>
#include <stdint.h>
// define type scalar
typedef int64_t scalar;
// class definition
class Point {
public:
Point(
scalar x, // input
scalar y // input
);
void print_point();
private:
scalar x;
scalar y;
};
// class methods
Point::Point(scalar x, scalar y)
{
this->x = x;
this->y = y;
}
void Point::print_point()
{
//print (x,y)
printf("(%d,", x); printf("%d)\n", y);
}
// main
int main()
{
scalar a = 5;
printf("%d\n", 5);
Point* A = new Point(5,1);
A->print_point();
return 0;
}
I compile this code with the following command:
g++ -o test test.cpp
when I compile the code in my linux computer, the program works fine and it prints out:
5
(5,1)
The problem is that when I do the exact same thing on my Raspberry Pi, the programs prints out:
5
(23867400,67288)
Do you have any idea why ? How can I fix this problem ?