Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#16247 - [crypto++] unable to link

Attached to Project: Arch Linux
Opened by Caleb Cushing (xenoterracide) - Friday, 18 September 2009, 15:15 GMT
Last edited by Giovanni Scafora (giovanni) - Friday, 18 September 2009, 18:41 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Giovanni Scafora (giovanni)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


/*the code*/
#include <cryptopp/sha.h>
#include <cryptopp/hex.h>
#include <cryptopp/files.h>
#include <boost/filesystem.hpp>
#include <string>
#include <iostream>

using namespace std;
using namespace boost::filesystem;

string getSha1Hash(const path &file, bool uppercase)
string result;
CryptoPP::SHA1 hash;
new CryptoPP::HashFilter(hash, new
new CryptoPP::StringSink(result),uppercase)));
return result;


int main()
string sha1;
path file("test.txt");
sha1 = getSha1Hash(file, true);
cout << sha1 << endl;


compiler command and output
g++ -lboost_filesystem -lcryptopp sha1.cpp

tmp/cctxcX1W.o: In function `getSha1Hash
std::char_traits<char>, std::allocator<char> >,
boost::filesystem::path_traits> const&,
sha1.cpp:(.text+0x5a): undefined reference to
std::char_traits<char>, std::allocator<char> > >::StringSinkTemplate
(std::basic_string<char, std::char_traits<char>, std::allocator<char>

sha1.cpp:(.text+0x117): undefined reference to
sha1.cpp:(.text+0x11d): undefined reference to
sha1.cpp:(.text+0x133): undefined reference to
CryptoPP::BufferedTransformation*, bool, int, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
/tmp/cctxcX1W.o: In function

according to crypto++ mailing list code works elsewhere (ubuntu). link to cryptopp dialog

This task depends upon

Closed by  Giovanni Scafora (giovanni)
Friday, 18 September 2009, 18:41 GMT
Reason for closing:  Not a bug
Comment by Giovanni Scafora (giovanni) - Friday, 18 September 2009, 18:40 GMT
These two commands work for me.

g++ -c -o sha1.o sha1.cpp
g++ -o sha1 sha1.o -lcryptopp -lboost_filesystem

Since sha1.o requires symbols from libcryptopp.a it should appear first on the command line.
For some reason not all systems are that strict when it comes to library order.