You are here

"Undefined reference" error - need a pointer or two

5 posts / 0 new
Last post
computerfreaker
computerfreaker's picture
Offline
Last seen: 10 years 10 months ago
Developer
Joined: 2009-08-11 11:24
"Undefined reference" error - need a pointer or two

I'm trying to finish the last of my work with Portable Passwords, and the code is all compiling nicely, but the darn thing keeps failing on the linking stage with the error "Undefined reference to 'SQLite::SQLite(wchar_t const*, int, wchar_t const*)'". I did some research and found that "Undefined reference" usually means the referenced library hasn't been linked, so I compiled the SQLite code as a static library and linked the resulting libSQLite.a file in Portable Passwords. I also included the directory the SQLite library is in as a linker search path, but still no joy.

Does anybody know what might be going on here and how I can fix it? I'm using the MinGW compiler with Code::Blocks, if that matters.

Thank you very much!

computerfreaker

Zach Thibeau
Zach Thibeau's picture
Offline
Last seen: 8 years 7 months ago
Developer
Joined: 2006-05-26 12:08
if you could pastebin the

if you could pastebin the code that the error is originating IE Password.c/h etc etc and what line it is found in

your friendly neighbourhood moderator Zach Thibeau

The MAZZTer
The MAZZTer's picture
Offline
Last seen: 4 years 1 month ago
Developer
Joined: 2006-11-17 15:31
Sorry

I used Visual Studio Express myself so I can't help with this problem. Sad I don't recall needing a library though? I included all the needed stuff in Other\Source, IIRC.

Signature automatically removed for being too awesome.

Mark Sikkema
Offline
Last seen: 10 years 9 months ago
Developer
Joined: 2009-07-20 14:55
Ah, this code came from

Ah, this code came from ChromePortable !

I had a bit more luck compiling it from the ChromeP source folder, but am still getting a lot of warnings when compiling with MinGW.

A few questions, did you write this plug-in or can you tell me where this code came from ?

Did you also get warnings like this, when compiling with Visual Studio Express (2010 Beta 2) ?

I haven't tested the plug-in, but these warnings do not look very good Sad

Formerly Gringoloco
Windows XP Pro sp3 x32

Mark Sikkema
Offline
Last seen: 10 years 9 months ago
Developer
Joined: 2009-07-20 14:55
as I mentioned in the other

as I mentioned in the other tread, you got to convert the string into utf-8 and pass it as SQLite::SQLite(char const*, int, char const*) instead of wchar_t.

See the comment in 'sqlite3.c' :

Note to Windows users: The encoding used for the filename argument
** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
** codepage is currently defined. Filenames containing international
** characters must be converted to UTF-8 prior to passing them into
** sqlite3_open() or sqlite3_open_v2().

I'm a bit confused about the 'const TCHAR*' in 'SQLite::SQLite()':

SQLite::SQLite(const TCHAR* filename, int flags, const TCHAR* zVfs) {
  handle = 0;
  int ret;
  if ((ret = sqlite3_open_v2(filename, &handle, flags, zVfs)) != SQLITE_OK || !handle) {
	Close();
	throw ret;
  }
}

but see the declaration of sqlite3_open_v2():

SQLITE_API int sqlite3_open_v2(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  int flags,              /* Flags */
  const char *zVfs        /* Name of VFS module to use */
);

If I could meet you in IRC, maybe you could help me to compile this in MinGW. I can't seem to set it up right. I'm getting:

error: `SecureZeroMemory' was not declared in this scope

..and then see if we could work it out together Smile

edit: Ok, got it to compile (try including 'sqlite.cpp' into your project), but lots of warnings with MinGW !
Anyway I think your best bet would be to use the ChromeP password plug-in (rename it if you'd like), plus use CallANSIPlugin.nsh (which is also included in PAL 2.1 beta) plus something like this header file. This way you would use the already proven plug-in and pass it the utf-8 strings like sqlite needs.
Disclaimer: I haven't tested any of this.

Formerly Gringoloco
Windows XP Pro sp3 x32

Log in or register to post comments