A problem on libcma.so in c++

version: pynq-z2.5
I get a version of fpga lstm-pynq from the xilinx github repository. I study the method it took. I find it used the way of c++ to allocate the memory. It was use the libxlnk_cma.h in the /usr/include and the libcma.so in the /usr/lib. I tried the method but I get a problem.
The following is my test code.

#include <stdint.h>
#include <iostream>
using namespace std;

extern "C" {
#include <libxlnk_cma.h>
}

int main()
{
        uint32_t* m_reg = reinterpret_cast<uint32_t*>(cma_mmap(0x43c00000, 64 * 1024));
	if(!m_reg)
        {
                cout << "mmap error" << endl;
        }
        cout << "test xxx" << endl;
        return 0;
}

I use the command of g++ to compile it

 g++ main.cpp -lcma -lpthread -o main

following is if error information of running ./main in shell :

ERROR: /dev/mem can't be opened
ERROR: Counter physical addresses not mapped yet!
ERROR: /dev/mem can't be opened
mmap error
test xxx
ERROR: Counter physical addresses not mapped yet!

the same error with the function of cma_alloc.
Can I get some help? Thanks.

Are you running the program as root either in a root shell or with sudo?

Peter

thankyou, sudo can solve this.