Ahead of Greece's referendum on the country's future in Europe, the head of the Organisation for Economic Co-operation and Development told CNBC that the future of the region is at stake.

"(The) euro is not in danger, it's Europe that's at stake. It took us all these years to build it," Angel Gurria, Secretary-General of the OECD, said on Thursday.

"This Greek problem happened because, one day a few years ago we had a rounding problem. They said they had a 5 percent deficit and it was 15 percent. We've been struggling with the problem ever since."

Greece's government admitted in 2004 that it had under-reported the country's budget deficit figures when it applied to joined the euro zone.

'Yes' or 'No'

Chris Ratcliffe | Bloomberg | Getty Images

People read newspaper front pages as they hang outside a news kiosk in the Plaka district of Athens, Greece, on Thursday, July 2, 2015.

Gurria's comments come as all eyes focus on the Greek poll this weekend, when citizens will vote either "yes" to more austerity – and effectively a future in the euro zone -- or "no," and a potential exit from the single currency.

The latest opinion poll, conducted by the ALCO polling institute and published in the Ethnos newspaper on Friday, pointed to a close result. The "yes" vote supporting creditors' reform proposals came in at 44.8 percent, the "no" vote stood at 43.4 percent, and 1.8 percent were undecided.

However, it also showed that 74 percent wanted to remain in the euro, against 15 percent, who wanted a "national currency."

Gurria warned that it was in everybody's interest "to keep Europe together" although he said he recognized that there were political, legal and financial constraints on the bodies which oversee Greece's bailout -- the International Monetary Fund (IMF), European Central Bank (ECB) and European Commission.

"The solution will come from the understandings of those constraints, and at the same time -- and I think this is actually going to happen -- of moving above the shorter-term interest in the understanding that it's in everybody's interest to keep Europe together," he added.

Although talks between the radical left government in Greece and its lenders have been ongoing since February, Greece's crisis peaked last Friday night when Prime Minister Alexis Tsipras announced a referendum.

That move prompted the ECB to cap its emergency funding for Greek banks and capital controls have been imposed, which are expected to remain in place until after the vote. Now banks' cash reserves are reportedly running out, with the daily allowance from ATMs reduced from 60 euros to 50 euros.

The ECB's policymakers are expected to next discuss further emergency funding assistance (ELA) for Greek banks on Monday, a person familiar with the matter told Reuters Thursday.

'We'll get a deal'

There were hopes mid-week that Greece could be prepared to climb down on its opposition to some major reforms and spending cuts. However, these were dashed when lenders said there would be no more talks until after the referendum and Tsipras urged Greeks to vote "no" against reforms.

On Thursday, the IMF warned that Greece would need comprehensive debt relief and more financial aid over the next three years of over 50 billion euros ($55 billion). Earlier this week, Greece effectively defaulted on a 1.6-billion-euro debt to the fund, making it the first advanced economy to do so.

Despite the impasse being Greece and its lenders, however, Gurria said a deal could still be found.

"My impression is that because of the willingness of both parties to come together…we are not so far away (from a deal)," he said. "All discussions seem to go to the eleventh hour for some …but I think we'll get a deal."