World leaders must work together to solve today's pressing problems or risk sleepwalking to disaster, German Chancellor Angela Merkel said Wednesday.

That message was reinforced by French President Emmanuel Macron hours later as he made the case for a new framework to ensure globalization benefits everyone.

"This framework should be based on cooperation and multilateralism," he said at the World Economic Forum in Davos.

Neither leader mentioned President Trump by name but both took thinly veiled digs at the American president, who has pulled the U.S. out of the Paris accord on climate change and ditched a Pacific trade deal he blasted as unfair.

Trump is expected to promote his "America first" agenda when he addresses the forum on Friday.

Merkel said it was far from clear that the lessons of the last century and its two World Wars had been learned.

"We think that shutting ourselves off from the rest of the world, isolating ourselves will not lead us into a good future. Protectionism is not the answer," she said.

Macron used his address to call on top business and government leaders to come together to make global capitalism work for the many, not just the few.

"There are people who think [the] solution is to get out of globalization," he said. "There are more and more people who are convinced that that is the right option... It means we have a major challenge to meet."

Related: Team Trump talks taxes in Davos

Other world leaders have already defended global cooperation at the forum.

Indian Prime Minister Narendra Modi kicked off the conference by warning that protectionism was resulting in new trade barriers. Canadian Prime Minister Justin Trudeau used his address to announce that Pacific nations had finalized the major trade deal Trump quit in 2017.

Davos: Complete coverage

Merkel acknowledged that issues such as migration and the aftermath of Europe's debt crisis were driving political polarization in Germany and Europe. People were also worried that their leaders wouldn't be able to solve the challenge of disruptive technological change in a "fair and equitable" way.

But she said the answer was more cooperation, not less.

"The better we can overcome divisions at home, the freer we will be to engage with others in multilateral fora," she said

Reaching multilateral solutions requires patience, but is worthwhile in the long run, she said.

Merkel also spoke about the need for global cooperation to tackle climate change and make free trade fairer, while warning the audience about the danger of populism, calling it "a poison."

Related: Team Trump talks taxes in Davos

The sentiment was echoed by Italian Prime Minister Paolo Gentiloni, who said he respects the desire of political leaders to defend their own citizens, companies and economy.

"But obviously there is a limit and the limit is the framework we are all living in ... a framework given by trade agreements, free trade, international rules, multilateral decisions, and we have to keep this system functioning," he said.

-- Alanna Petroff contributed to this report.