Thread: Problem with SQLite and wxWigets

  1. #1
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118

    Problem with SQLite and wxWigets

    I am trying to compile a project that includes wxWidgets and SQLite3 on CodeBlocks.
    Now the problem is on compilation C:B says

    Undefined Reference to "sqlite3_open()"
    ...
    and so on.
    Google told me that I should add -lsqlite3 to the linker options in build options of project so I did and the resulting string was

    `wx-config sqlite3 --libs`

    but now the linker is saying

    cannot find -lwx_gtk2u_sqlite3-2.8

    I am using Linux(Ubuntu 12.10)

    Please Help...

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Sounds like it can't find a required library. Have you checked your paths so the linker can find it (unless it's missing?)?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118
    The syntax for command line arguments is correct?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Instead of linking with -lsqlite3, it may be easier to just add the SQLite3 amalgamation file as if it were just another of your source files, and add the SQLite3 header as if it were just another of your header files.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118
    Quote Originally Posted by laserlight View Post
    Instead of linking with -lsqlite3, it may be easier to just add the SQLite3 amalgamation file as if it were just another of your source files, and add the SQLite3 header as if it were just another of your header files.
    Yes, that would be the last option!

  6. #6
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118
    Done :-)

    I just tried the command 'wx-config --libs' on the terminal which returned this

    -L/usr/lib/i386-linux-gnu -pthread -L/usr/lib/i386-linux-gnu -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8

    so I copied the whole text added '-lsqlite3' at the begining and paste it in linker options. After that all goes well.... :->
    Thanks a lot.....

  7. #7
    Registered User
    Join Date
    Jul 2012
    Location
    Australia
    Posts
    242
    Quote Originally Posted by laserlight View Post
    Instead of linking with -lsqlite3, it may be easier to just add the SQLite3 amalgamation file as if it were just another of your source files, and add the SQLite3 header as if it were just another of your header files.
    This was exactly what I did to get SQLite to work with MingW.
    IDE: Code::Blocks | Compiler Suite for Windows: TDM-GCC (MingW, gdb)

  8. #8
    Infant of C
    Join Date
    May 2010
    Location
    Karachi, Pakistan
    Posts
    118
    This will increase the size of executable!
    Will it?
    I mean there must be some of the cpp/c files in sqlite that I might not be using in my source but I dont know of them. I add them and they are use less. It will increase the size of my executable that is use less?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. wxwigets and wxsmith
    By C_programmer.C in forum C++ Programming
    Replies: 2
    Last Post: 11-25-2012, 05:20 AM
  2. Problems With SQLite
    By C_programmer.C in forum C++ Programming
    Replies: 2
    Last Post: 11-09-2012, 01:42 PM
  3. SQLite in C
    By bluechip in forum C Programming
    Replies: 2
    Last Post: 10-14-2012, 12:32 PM
  4. How to using SQLite with WINAPI
    By nostromos in forum Windows Programming
    Replies: 1
    Last Post: 10-02-2005, 01:53 AM
  5. Using SQLite?
    By IM! in forum C++ Programming
    Replies: 18
    Last Post: 03-16-2005, 04:00 AM