Here's my includes:
#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h> //for snprintf
#include <libscrypt.h>
#include <sqlite3.h>
#include "generator.h" //has no dependencies
And here's my g++ 4.2.1 command with compilation errors:
# g++ -I/usr/local/include -L /usr/local/lib test.cpp generator.cpp -o test -lscrypt -lsqlite3
/tmp//cctxmw4C.o: In function `insertUser()':
test.cpp:(.text+0x607): undefined reference to `libscrypt_salt_gen(unsigned char*, unsigned long)'
test.cpp:(.text+0x6c3): undefined reference to `libscrypt_scrypt(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned long long, unsigned int, unsigned int, unsigned char*, unsigned long)'
collect2: ld returned 1 exit status
Similar C code compiles fine with GCC. I do not believe that the order of the parameters is the problem -- I have tried multiple variations, including moving the -I, -L, and both -l flags. Both scrypt and sqlite3 are C libraries, and sqlite3 throws no errors despite having the header and shared library in -I and -L respectively.