MySQL and C++ lib error - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28

Thread: MySQL and C++ lib error

  1. #16
    Join Date
    Apr 1999
    Posts
    27,433

    Re: MySQL and C++ lib error

    Here is the lib file that was installed on my machine.

    libsql.zip

    Regards,

    Paul McKenzie

  2. #17
    Join Date
    Oct 2013
    Posts
    39

    Re: MySQL and C++ lib error

    Quote Originally Posted by Paul McKenzie View Post
    Here is the lib file that was installed on my machine.

    libsql.zip

    Regards,

    Paul McKenzie
    works, why?

  3. #18
    Join Date
    Apr 1999
    Posts
    27,433

    Re: MySQL and C++ lib error

    Quote Originally Posted by DaigonoYouso View Post
    works, why?
    It works because it does. This is what is installed by the MySql installer -- it has to work, else the people at MySql needs to go back and provide a workable lib file.

    Regards,

    Paul McKenzie

  4. #19
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,467

    Re: MySQL and C++ lib error

    Quote Originally Posted by DaigonoYouso View Post
    works, why?
    It is wrong question! It "works" just because this lib file was created to "work"!
    The question you have to ask is: why does your lib file not work? I guess it is because "your" lib is NOT for 32-bit debug version or the file was corrupted.
    Victor Nijegorodov

  5. #20
    Join Date
    Oct 2013
    Posts
    39

    Re: MySQL and C++ lib error

    Quote Originally Posted by VictorN View Post
    It is wrong question! It "works" just because this lib file was created to "work"!
    The question you have to ask is: why does your lib file not work? I guess it is because "your" lib is NOT for 32-bit debug version or the file was corrupted.
    32bit release version*

    yeah, I said that it is probvably for a 64 bit, but I have no idea why, I downloaded installer for 32 bit

  6. #21
    Join Date
    Apr 1999
    Posts
    27,433

    Re: MySQL and C++ lib error

    Quote Originally Posted by DaigonoYouso View Post
    32bit release version*

    yeah, I said that it is probvably for a 64 bit, but I have no idea why, I downloaded installer for 32 bit
    Well, I downloaded the installer last night, and didn't do anything beyond that except make the installer run.

    Make sure that you are pointing to the proper directory. Maybe the installer can detect what system you're running, and install both 32 and 64 bit versions. If that is the case, then usually 32-bit versions are installed in "Program Files (x86)" and not "Program Files". I am running a 32-bit only system, and installing caused no issues.

    Regards,

    Paul McKenzie

  7. #22
    Join Date
    Oct 2013
    Posts
    39

    Re: MySQL and C++ lib error

    Quote Originally Posted by Paul McKenzie View Post
    Well, I downloaded the installer last night, and didn't do anything beyond that except make the installer run.

    Make sure that you are pointing to the proper directory. Maybe the installer can detect what system you're running, and install both 32 and 64 bit versions. If that is the case, then usually 32-bit versions are installed in "Program Files (x86)" and not "Program Files". I am running a 32-bit only system, and installing caused no issues.

    Regards,

    Paul McKenzie
    well yeah, i have 64 bit and its installed in program files, not x86 ones

  8. #23
    Join Date
    Nov 2004
    Posts
    17

    Re: MySQL and C++ lib error

    Hey was just reading through this thread, i am in the same situtation now, i downloaded the x86 mysql installer and picked developer enviroment, now the directories path is C:\Program Files\MySQL\MySQL Server 5.6, and i changed my project from x86 to x64 and it compiled fine, now why would it compile with x64 if i downloaded x86 installer?, how would i get the x86 version of the mysql library so i can use it with an x86 project, thanks if you can help...

  9. #24
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,358

    Re: MySQL and C++ lib error

    Quote Originally Posted by Anddos View Post
    Hey was just reading through this thread, i am in the same situtation now, i downloaded the x86 mysql installer and picked developer enviroment, now the directories path is C:\Program Files\MySQL\MySQL Server 5.6, and i changed my project from x86 to x64 and it compiled fine, now why would it compile with x64 if i downloaded x86 installer?, how would i get the x86 version of the mysql library so i can use it with an x86 project, thanks if you can help...
    Looks like the x86 installer detected the 64-bit system and installed the 64-bit version. If it had installed the 32-bit version, it would have installed to C:\Program Files (x86)\etc, not C:\Program Files\etc.

    You might try checking if the installer installed to both locations (C:\Program Files\MySQL & and C:\Program Files (x86)\MySQL), otherwise, I'd post a question to the MySQL forum directly.

  10. #25
    Join Date
    Nov 2004
    Posts
    17

    Re: MySQL and C++ lib error

    Quote Originally Posted by Arjay View Post
    Looks like the x86 installer detected the 64-bit system and installed the 64-bit version. If it had installed the 32-bit version, it would have installed to C:\Program Files (x86)\etc, not C:\Program Files\etc.

    You might try checking if the installer installed to both locations (C:\Program Files\MySQL & and C:\Program Files (x86)\MySQL), otherwise, I'd post a question to the MySQL forum directly.
    theres no MySQL Server 5.6 in C:\Program Files (x86)\MySQL), i dont think posting in the mysql section will help as mysql.h is used for programming related and there is no issues with the server etc..

  11. #26
    Join Date
    Nov 2004
    Posts
    17

    Re: MySQL and C++ lib error

    ive got it compiled by installing the x86 package on a vmware x86 and copying the x86 files over to this pc, its clear to me the x86 installer installs x64 library even those they say x86 package..

  12. #27
    Join Date
    Nov 2004
    Posts
    17

    Re: MySQL and C++ lib error

    Now when i run the program its crashing and i cannot understand why
    The source code as follows

    Code:
    #include "stdafx.h"
    //#include "my_global.h" // Include this file first to avoid problems
    #include <mysql.h> // MySQL Include File
    #define SERVER "127.0.0.1"
    #define USER "root"
    #define PASSWORD "letmein"
    #define DATABASE "test"
    #pragma comment(lib,"libmysql.lib")
    #pragma comment(lib,"mysqlclient.lib")
    
    int main()
    {
    	MYSQL *connect; // Create a pointer to the MySQL instance
    	connect = mysql_init(NULL); // Initialise the instance
    	/* This If is irrelevant and you don't need to show it. I kept it in for Fault Testing.*/
    	if (!connect)    /* If instance didn't initialize say so and exit with fault.*/
    	{
    		fprintf(stderr, "MySQL Initialization Failed");
    		return 1;
    	}
    	/* Now we will actually connect to the specific database.*/
    
    	connect = mysql_real_connect(connect, SERVER, USER, PASSWORD, DATABASE, 0, NULL, 0);
    	/* Following if statements are unneeded too, but it's worth it to show on your
    	first app, so that if your database is empty or the query didn't return anything it
    	will at least let you know that the connection to the mysql server was established. */
    
    	if (connect){
    		printf("Connection Succeeded\n");
    	}
    	else{
    		printf("Connection Failed!\n");
    	}
    	MYSQL_RES *res_set; /* Create a pointer to recieve the return value.*/
    	MYSQL_ROW row;  /* Assign variable for rows. */
    	mysql_query(connect, "SELECT * FROM TABLE");
    	/* Send a query to the database. */
    	unsigned int i = 0; /* Create a counter for the rows */
    
    	res_set = mysql_store_result(connect); /* Receive the result and store it in res_set */
    
    	unsigned int numrows = mysql_num_rows(res_set); /* Create the count to print all rows */
    
    	/* This while is to print all rows and not just the first row found, */
    
    	while ((row = mysql_fetch_row(res_set)) != NULL){
    		printf("%s\n", row[i] != NULL ?
    			row[i] : "NULL"); /* Print the row data */
    	}
    	mysql_close(connect);   /* Close and shutdown */
    	return 0;
    }
    Thanks if you can help

  13. #28
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,544

    Re: MySQL and C++ lib error

    Now when i run the program its crashing and i cannot understand why
    ... and using the debugger, the crash occurs where?
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center