GABCIKOVO, Slovakia — Since Slovakia joined the European Union in 2004, Emil Hirjak’s fortunes have risen along with his country’s.

Now 46, Mr. Hirjak has a wood products company and just bought a small sawmill in Gabcikovo. He has benefited from the bloc’s free movement of travel, goods and labor.

“Young people who are clever can travel and work abroad, and come back or not, and as for the economy, we can export,” he said. “We wouldn’t survive otherwise.”

He ought to be a cheerleader for the European Union, but he is ambivalent at best. And his ambivalence speaks to a fundamental and growing problem for the union. Even in countries that have prospered, public sentiment is steadily shifting against Brussels.