You can, but that's irritating to do. In the case of the Pi there is no barrel connector, it's a USB port. So your only option is the header, either directly into the holes if its unpopulated, or get a 40-way female header and solder to that, or go for a daughter board.