“I am certain that you will carry out whatever is asked of you with the pride that comes of being at the forefront of our Naval prowess. Wherever she is asked to serve her country, may she and her company return safely to harbour.”

Earlier, the Duchess told the crowds that seven shipyards across the country have worked together to design and build the carrier and its sister ship, HMS Queen Elizabeth.

“Not only do they represent an extraordinary achievement, but also a new era in our long Naval history,” Camilla said.

She wore a navy blue dress and coat designed by Fiona Clare for the occasion, along with a navy and white Philip Treacy hat and a Prince of Wales feathered brooch. Charles, Admiral of the Fleet, sported a Royal Navy uniform with medals.

Camilla told the hundreds of people gathered at the dockyard that the ship is the seventh in the Navy to bear the name HMS Prince of Wales, with the first being launched in 1765.

The “most distinguished” was a King George V class battleship, launched in 1939, which played a vital part in the Second World War.

It was sunk in the South China Sea in December 1941, with the loss of 327 lives. Three men who served on the battleship were present at Friday’s ceremony.

Sister ship HMS Queen Elizabeth was the first aircraft carrier to be built in the programme and set sail from Rosyth this summer.

HMS Prince of Wales is set to follow in 2019 and those working on the 280-metre carrier say lessons have been learned in the construction of the first ship which will make the second “more efficient”.

The pair are termed Queen Elizabeth Class aircraft carriers and are being built by the Aircraft Carrier Alliance (ACA), a partnership of BAE Systems, Babcock, Thales and the Ministry of Defence.

Overall, six shipyards around the UK - Appledore, Birkenhead, Govan, Portsmouth, Rosyth and Tyne - have been involved in building various parts of the carriers.

Those behind the project, which costs an estimated £6.2 billion overall, say the QE Class will be the centrepiece of Britain’s naval capability with an aircraft carrier permanently available to be deployed anywhere in the world in military or humanitarian action.

First Sea Lord Admiral Sir Philip Jones said during the ceremony: “In the few short months since she put to sea, HMS Queen Elizabeth has become an icon of British engineering and British innovation, and it was a joyous occasion to welcome her into her home port of Portsmouth just over three weeks ago.

“The same will be true for HMS Prince of Wales. Wherever she travels, at home or overseas, she will draw crowds to the water’s edge where they will marvel at your achievement.

“Alone, either one of these vessels would be a formidable expression of military might. But together, HMS Queen Elizabeth and HMS Prince of Wales send a powerful message to friend and foe alike.

“We may live in uncertain times, but the United Kingdom has lost none of its famous resolve. We will protect our interests, we will support our allies, and we will shoulder our responsibilities, wherever in the world they are at stake.”

Stephen Moorhouse was named the first seagoing captain of HMS Prince of Wales this week and will take over from captain Ian Groom, currently the Senior Naval Officer on board the ship during the carrier’s build programme.

Captain Moorhouse is a former Commanding Officer of HMS Ocean and HMS Lancaster.

The 44-year-old said: “Seeing our sister ship HMS Queen Elizabeth make her debut in Portsmouth last month was an amazing sight and I look forward to one day bringing HMS Prince of Wales home to the same warm welcome.

“Until then the ship’s company in Rosyth will continue to grow and they have much to be proud of in all the work they have done so far, working with our civilian industry partners to bring this ship to life.”

Mr Brown said: “Having had the opportunity to visit the Queen Elizabeth during its construction in 2013, it is good to be back here today at Rosyth, to witness this ceremony to name the Prince of Wales aircraft carrier.

“I am pleased to have the opportunity to congratulate everybody involved in the building of this ship and to recognise the top quality skills of the workforce on display.

“With their proud shipbuilding history, it is fitting that the yards on the Clyde and at Rosyth could play such a pivotal role in the construction of this massive vessel and of course, its sister ship HMS Queen Elizabeth.

“The expertise that went into the design, engineering and build of this vessel is a testament to our shipbuilding capabilities in Scotland.

“This is further proof that Scottish shipyards possess the skills and capability to deliver ships of high quality.”