That sounds like a problem with loading the program into the device, not with compiling the program. It sounds like the programmer is not able to communicate with the MCU. The Atmel ICE has two programming connectors, make sure you are using the one labeled "SAM" and you are using the correct cables/adapters (the Atmel-ICE need one of the connectors on the ribbon cable to be reversed, so make sure you use the ribbon cables it came with).
It could help if you go to Tools > Device Programming and share a screenshot of the interface settings. What is the board you are programming, is it a custom PCB? Can you show how the programming interface is connected to the MCU?