Thanks to Jeffrey Walton and coshvji cujmlqef I tried both of your methods but they both print the following errors:
terminate called after throwing an instance of 'CryptoPP::FileStore::ReadErr' what(): FileStore: error reading file -- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/20894b9a-ff9e-411c-97dc-58899af3ed3en%40googlegroups.com.