私はg++ -lkeyczar -lcrypto -o basic_encrypt -Wall -O2 base_encrypt.cpp次のコードをコンパイルするために使用しています:
#include <cassert>
#include <iostream>
#include <string>
#include <keyczar/keyczar.h>
void EncryptAndDecrypt(const std::string& location) {
  keyczar::Keyczar* crypter = keyczar::Crypter::Read(location);
  if (!crypter)
    return;
  std::string input = "Secret message";
  std::string ciphertext;
  std::cout << "Plaintext: " << input << std::endl;
  bool result = crypter->Encrypt(input, &ciphertext);
  if (result) {
    std::cout << "Ciphertext (Base64w): " << ciphertext << std::endl;
    std::string decrypted_input;
    bool result = crypter->Decrypt(ciphertext, &decrypted_input);
    if (result)
      assert(input == decrypted_input);
  }
  delete crypter;
}
int main(int argc, char** argv) {
  if (argc != 2) {
    std::cout << "An absolute key set location must be provided as argument"
              << std::endl;
    return 1;  // error
  }
  // The first argument must represent the keyset's location
  const std::string location(argv[1]);
  EncryptAndDecrypt(location);
  return 0;
}
これはここから取ったチュートリアルです
ただし、次のエラーが発生しています。
/tmp/ccNlack3.o: In function `EncryptAndDecrypt(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
base_encrypt.cpp:(.text+0xf): undefined reference to `keyczar::Crypter::Read(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: ld returned 1 exit status
コンパイル中にすでにライブラリフラグを指定していることがわかっているため、これを解決できません。それでも正しくリンクできないのはなぜですか?