problem in MySQL with VC++6 in Win2000

This is a discussion on problem in MySQL with VC++6 in Win2000 within the C Programming forums, part of the General Programming Boards category; Dear Friends, I'm Ashok Kumar.P.S, a new member to this forum. i need one urgent help from u. I'm using ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    3

    Exclamation problem in MySQL with VC++6 in Win2000

    Dear Friends,
    I'm Ashok Kumar.P.S, a new member to this forum. i need one urgent help from u. I'm using Win2000 and i tried to create a client program for MySQL4.1 using VC++6. I had installed the MySQL using msi package(Windows Installer, Source distribution). when i'm trying to run the pgm it's giving some linker errors. i gave those errs here followed by the pgm.(There is no compilation errs).
    And also i added the lib directory in the option menu( both the directories inside the lib(opt and debug)).
    Is it necessary to use the MySQL binary distribution?

    Code:
    #include <my_global.h>
    #include <my_sys.h>
    #include <mysql.h>
    
    static char *opt_host_name = NULL;
    static char *opt_user_name = NULL;
    static char *opt_password = NULL; 
    static unsigned int opt_port_num = 0;
    static char *opt_socket_name = NULL;
    static char *opt_db_name = NULL; 
    static unsigned int opt_flags = 0; 
    
    static MYSQL *conn;
    int main (int argc, char *argv[])
    {
      conn = mysql_init (NULL);
      if (conn == NULL)
      {
         fprintf (stderr, "mysql_init() failed (probably out of memory)\n");
         exit (1);
      }
    
      if (mysql_real_connect (conn, opt_host_name, opt_user_name,  opt_password, opt_db_name, opt_port_num, opt_socket_name, opt_flags) == NULL)
      {
         fprintf (stderr, "mysql_real_connect() failed\n");
         mysql_close (conn);
         exit (1);
      }
    
      mysql_close (conn);
      exit (0);
    }
    
    
    The errs r:
    
    userinfo.obj : error LINK2001 : unresolved external symbol _mysql_close@4
    userinfo.obj : error LINK2001 : unresolved external symbol _mysql_real_connect@32
    userinfo.obj : error LINK2001 : unresolved external symbol _mysql_init@4
    userinfo.obj : error LINK2001 : unresolved external symbol _winmain@16



    I don't know why its happening. pls give me some suggestions.
    I'm waiting for ur replies.

    Thanks and Regards,
    Ashok Kumar.P.S

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    It shouldn't be nessesary to use the binary distribution.

    "undefined reference to winmain16" sounds like it can't find main().

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Did you compile the source into the library(s)?
    You also need to add the .lib file(s) to your project by going to project->settings and clicking the link tab.
    As for the winmain error, this happens when you have a mina() function but try to compile a GUI app. Either change it to a console app or use a winmain function.

  4. #4
    Registered User
    Join Date
    May 2005
    Posts
    3

    Thumbs up Thank u guys....

    Ashok here, a new member of this forum. I'm very much excited. what a wonderful forum this is! Immediate response to my query. I'm a lucky man, because i found this forum. Thank u guys. Thank u for ur help and immediate responses.

    Thanks and regards,
    Ashok Kumar.P.S

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    So we solved your problem?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. Installing MySQL
    By cerin in forum Tech Board
    Replies: 2
    Last Post: 02-18-2006, 12:30 PM
  3. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  4. Problem connecting to MySQL Database?
    By MrLucky in forum C++ Programming
    Replies: 5
    Last Post: 01-30-2006, 11:30 AM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 09:37 AM

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