Sponsored Content
Top Forums Programming Trubble in executing the cpp program... Post 302248876 by ps_sach on Monday 20th of October 2008 02:55:00 AM
Old 10-20-2008
MySQL Can't get the output...

I wrote a code like this.......

#include <iostream>
#include <stdio.h>
#include <mysql.h>
#include <string.h>
#include <stdlib.h>

using namespace std;

#include "Connection.h"


int main()
{
char *Host = (char *)"localhost";
char *Database =(char *)"sachin";
char *UserId =(char *)"root";
char *Password =NULL;
Result *result;
char *query;
Connection DbConnection(Host, Database, UserId, Password);
query="select * from the test"; // test is my database
result = DbConnection.Query(query); // perform the required database operation..


return 0;
}

Connection is the class & have connect function that just took the 4 arguments & establishes the connection to the mysql server ...Also Query is the function defined in connection class.

I m getting output as -
$g++ -c -I/usr/include/mysql Main.cpp
$ g++ -o Main Main.o -L/usr/lib/mysql -lmysqlclient
$./Main
terminate called after throwing an instance of 'char const*'
Aborted

I don't know why i m getting this output. I think it is related to the library.......

Can any one help me......

Last edited by ps_sach; 10-20-2008 at 05:45 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

executing a program within a program

Read the title: how do i do it? (4 Replies)
Discussion started by: Gekko
4 Replies

2. UNIX for Dummies Questions & Answers

executing the su command from a java program.

Say in unix (AIX) m/c, I am logged in with s1 user and want to start process p1 with user credentials of s2. I can do manually in this way: #su - s2 #enter password for s2> somePassword $ p1 But all this I have to do through a java program. How to pass the password through program. One... (1 Reply)
Discussion started by: shailendrat
1 Replies

3. Programming

Executing an .ec program in different informix versions

Hi all, I tried writing an .ec program connecting to informix database from solaris platform Sun 5.7 informix version that i had to used when i compiled the program was 9.21.UC3 the binary when i ported solaris box with informix version 9.40.UC5 i am unable to run that i am encountering... (0 Replies)
Discussion started by: matrixmadhan
0 Replies

4. Shell Programming and Scripting

convert cpp program to c shell script ?

Hi guys I tried to convert this c++ code to c shell script but there are some bugs and I don't know how to solve it. This code prints the three variables in decreasing order: int main() { int x,y,z; cin >> x >> y >>z; if ( x < y ) if ( x < z ) if ( y < z ) cout << x <<" " <<... (2 Replies)
Discussion started by: domain
2 Replies

5. Solaris

How to know the size of the program currently executing in memory

hey everybody, i am currently working on solaris 10 os on a m5000 server. my problem is when i want the exact size of a program in execution, i am unable to do it. earlier i thought the RSS field of prstat but because of its large size it cant be the size. pmap -x shows some output but it includes... (2 Replies)
Discussion started by: aryansheikh
2 Replies

6. Shell Programming and Scripting

Executing a Java Program

I am entirely new to shell scripting and would like to create a script to execute a java program called Main. I've already compiled it and placed the .java and .class files at /root/javaTest. Next I made a shell script that simply contained: java /root/javaTest/Main . I made the script... (2 Replies)
Discussion started by: hypnotic_meat
2 Replies

7. Shell Programming and Scripting

Executing WIN32OLE program

Hello, Please help me out to execute this perl program: #!/usr/bin/perl -w use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors... # get already active Excel application or open new my... (6 Replies)
Discussion started by: suvenduperl
6 Replies

8. UNIX for Dummies Questions & Answers

executing a different program

What system calls or commands do I need to use in order to execute a different program from an already running process? (1 Reply)
Discussion started by: justOne21
1 Replies

9. Programming

Error with shared lIBMpi.so.1 when compiling CPP program

Hello, Met a problem when compiling a C++ program from source code without error, but when ran it there was always an error message: ./Ray: error while loading shared libraries: libmpi_cxx.so.1: cannot open shared object file: No such file or directoryAs the error points to openmpi which was... (0 Replies)
Discussion started by: yifangt
0 Replies

10. Programming

Error in executing the C program

Hello Friends, I have written a code for the unisex bathroom which makes a policy that when a woman is in the bathroom only other women may enter, but not men, and vice versa. This program consists of four functions which a user defines but these functions are not properly working while... (4 Replies)
Discussion started by: Ravi Tej
4 Replies
PYSTE(1)							   User Commands							  PYSTE(1)

NAME
Pyste - Boost.Python code generator SYNOPSIS
pyste [options] interface-files DESCRIPTION
Pyste is a Boost.Python code generator. The user specifies the classes and functions to be exported using a simple interface file which, following the Boost.Python's philosophy, is simple Python code. Pyste then uses GCCXML to parse all the headers and extract the necessary information to automatically generate C++ code. --module=<name> The name of the module that will be generated; defaults to the first interface filename, without the extension. -I <path> Add an include path -D <symbol> Define symbol --multiple Create various cpps, instead of only one (useful during development) --out=<name> Specify output filename (default: <module>.cpp) in --multiple mode, this will be a directory --no-using Do not declare "using namespace boost"; use explicit declarations instead --pyste-ns=<name> Set the namespace where new types will be declared; default is the empty namespace --debug Writes the xml for each file parsed in the current directory --cache-dir=<dir> Directory for cache files (speeds up future runs) --only-create-cache Recreates all caches (doesn't generate code). --generate-main Generates the _main.cpp file (in multiple mode) --file-list A file with one pyste file per line. Use as a substitute for passing the files in the command line. --gccxml-path=<path> Path to gccxml executable (default: gccxml) --no-default-include Do not use INCLUDE environment variable for include files to pass along gccxml. -h, --help Print this help and exit -v, --version Print version information SEE ALSO
The full documentation for Pyste is maintained in HTML format. If you have the libboost-doc package installed, the manual starts at /usr/share/doc/libboost-doc/HTML/libs/python/pyste/index.html Pyste version 0.9.30 March 2008 PYSTE(1)
All times are GMT -4. The time now is 07:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy