-
October 30th, 2013, 10:50 AM
#16
Re: MySQL and C++ lib error
Here is the lib file that was installed on my machine.
libsql.zip
Regards,
Paul McKenzie
-
October 30th, 2013, 11:38 AM
#17
Re: MySQL and C++ lib error
Originally Posted by Paul McKenzie
Here is the lib file that was installed on my machine.
libsql.zip
Regards,
Paul McKenzie
works, why?
-
October 30th, 2013, 11:47 AM
#18
Re: MySQL and C++ lib error
Originally Posted by DaigonoYouso
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
-
October 30th, 2013, 11:47 AM
#19
Re: MySQL and C++ lib error
Originally Posted by DaigonoYouso
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
-
October 30th, 2013, 11:51 AM
#20
Re: MySQL and C++ lib error
Originally Posted by VictorN
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
-
October 30th, 2013, 11:58 AM
#21
Re: MySQL and C++ lib error
Originally Posted by DaigonoYouso
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
-
October 30th, 2013, 12:01 PM
#22
Re: MySQL and C++ lib error
Originally Posted by Paul McKenzie
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
-
September 13th, 2014, 05:39 AM
#23
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...
-
September 15th, 2014, 09:38 PM
#24
Re: MySQL and C++ lib error
Originally Posted by Anddos
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.
-
September 19th, 2014, 05:32 PM
#25
Re: MySQL and C++ lib error
Originally Posted by Arjay
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..
-
September 20th, 2014, 09:05 AM
#26
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..
-
September 21st, 2014, 07:44 PM
#27
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
-
September 22nd, 2014, 03:36 AM
#28
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. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|