calling a static function using linux g++

This is a discussion on calling a static function using linux g++ within the C++ Programming forums, part of the General Programming Boards category; easy question ... I am using g++ on linux RH7.1 and the libodbc++ library for database connectivity. I am trying ...

  1. #1
    Unregistered
    Guest

    Angry calling a static function using linux g++

    easy question ... I am using g++ on linux RH7.1 and the libodbc++ library for database connectivity. I am trying to call a static function (getConnection) that lives in DriverManager. I do this:

    odbc::Connection* conn;
    conn = odbc:riverManager::getConnection("test","test","test");

    I get the following compile error:

    /tmp/ccGq1zrn.o: In function `main':
    /tmp/ccGq1zrn.o(.text+0x6b): undefined reference to `odbc:riverManager::getConnection(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &)'
    collect2: ld returned 1 exit status

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    You need to link the library. The commandline flag to link with the library is -l, and libraries are typically named without the opening lib. So, the option is probably

    -lobdc++

    But I am not sure for that specific library.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  2. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  4. Question on function syntax and calling function
    By cbrman in forum C Programming
    Replies: 10
    Last Post: 10-05-2003, 06:32 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 05:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21