[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

C++ CGI MySQL++

I need to connect to a MySQL database using a C++ CGI. I've tried using mysql++ but I keep getting errors during compile. The only time I got it to work was when I used the Visual Studio project file that was included, but I prefer to stay away from Visual Studio. Using a different compiler, I get errors stating that there is a syntax error on the line that calls Connection, even though there isn't. Or I get an error stating that Socket is used an object.

I need someone to provide me with sample code that actually compiles, and tell me exactly what libs/header files to include.

I am using Bloodshed Dev C++, but am able to switch if there is a better compiler out there.
0
mvp836
Asked:
mvp836
  • 4
  • 3
  • 3
2 Solutions
 
Jaime OlivaresSoftware ArchitectCommented:
In fact you don't need a c++ wrapper, you can just work with mysql library:
http://downloads.mysql.com/archives.php?p=mysql-3.23

Have a look to this previous question for a sample:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20634727.html
0
 
AxterCommented:
>>The only time I got it to work was when I used the Visual Studio project file that was included, but I prefer to stay away from Visual
>>Studio.

If you're already have VC++, then I recommend sticking with it.

Why do you want to stay away from Viusal Studio?

Please post the exact compile errors you're getting, and the file.
0
 
mvp836Author Commented:
I follwed the second link posted by jaime, nd when i compile that segment of code, two of the errors I get are:
154 mysql_com.h 'SOCKET' is used as a type, but is  not defined as a type.
298 mysql_com.h syntax error before `,' token

mysql_com.h came with the mysql-noinstall-4.1.10-win32 package.

Axter, I would prefer to sty away from Visual Studio becuse it does not 100% comply with the C++ standards.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
AxterCommented:
>>Axter, I would prefer to sty away from Visual Studio becuse it does not 100% comply with the C++ standards.

There is no compiler that is a 100% compliant with the C++ standard.

VC++ 6.0 does have poor compliance with the standard, if you compare it to the GNU compiler (3.x)
However, VC++ 7.1 is more compliant to the C++ standard, then the GNU compiler (3.x)

So if you're really concern about a C++ compliant compiler, then I would move to VC++ 7.1, and not use the 3.x GNU compiler.
0
 
mvp836Author Commented:
Axter, even if you do believe that Visual Studio is more compliant than the GNU compiler, I would still like to stay away from a $109 product that only includes VC++ when I have a choice of several $0 products.

0
 
AxterCommented:
>>Axter, even if you do believe that Visual Studio is more compliant than the GNU compiler,

This is not what I believe.  It's the result of a third party study on multiple compilers, in which they rated them.  (FYI: VC++ 7.1 was not the highest rate compiler, but it was higher then the GNU compiler)

>>I would still like to stay away from a $109 product that only includes VC++ when I have a choice of several $0 products.

If price is the motivating factor, then yes, the GNU compiler would be the right choice.

But the GNU compiler is not a good choice if compliance to the standard is the only factor you're using, and that's the only reason you gave in your previous post.
0
 
mvp836Author Commented:
I also stated that I had a problem with connecting to MySQL, not that I wanted to find a compiler with compliance. This is C++ Programing, right? Not C++ Software?
0
 
AxterCommented:
>>also stated that I had a problem with connecting to MySQL, not that I wanted to find a compiler with compliance.
>>This is C++ Programing, right? Not C++ Software?

C++ Software is part of C++ programming. (Right???)

This topic area deals with everything and anything dealing with C++ programming.
0
 
Jaime OlivaresSoftware ArchitectCommented:
About the SOCKET problem, this is cause for the lack of a sockets library.
If you are building a Windows App, try to use:

#include <winsock2.h>    
#include <mysql.h>

0
 
Jaime OlivaresSoftware ArchitectCommented:
Since I have answered about your SOCKET problem, I want to comment this:
>>I would still like to stay away from a $109 product that only includes VC++ when I have a choice of several $0 products.
The is not a cero-cost product, you have to add the time you have to spend in the learning curve, and the time you spend in working with it (this is called the TCO - Total Cost of Ownership).
That's why cheapest Linux version has largely more TCO than Windows.
So, $109 Visual C++ is a cheap product, with dozens of libraries (MFC,ATL,COM,DCOM,.net,etc...) and programmers tools, and hundreds of supporting web pages (I like codeproject.com and codeguru.com).
Then, if you really preciate your time, take a while to think about this.
Good luck,
Jaime.
 
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now