LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-26-2017, 07:28 AM   #1
rahulvishwakarma
Member
 
Registered: Aug 2010
Posts: 53

Rep: Reputation: 0
error when in running codeblocks but in cmd prompt having error


hi to all, i've centos 6.6 as server and client in VM. when i ran in codeblocks 16.xx following program. :-
Code:
#include <mysql/mysql.h>
#include <mysql/my_global.h>
#include <mysql/my_sys.h>
#include <mysql/my_pthread.h>
#include <mysql/my_config.h>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>

static MYSQL * myconn;

int main(int argc, char **argv)
{
    MY_INIT(argv[0]);

    if(mysql_library_init(0,NULL,NULL))
    {
        fprintf(stderr, "mysql_init_library() failed");
        exit(1);
    }

    myconn = mysql_init(NULL);

    if( myconn == NULL)
    {
        fprintf(stderr, " mysql_init failed (perhaps due to  out of memory");
        exit(2);
    }

    if(mysql_real_connect(myconn, "oracle", "rahul", "rahul","test", 3306, NULL, 0) == NULL)
    {
        fprintf(stderr, "mysql_real_connect failed");
        mysql_close(myconn);
        exit(1);
    }

    fprintf(stdout, "connected successfully");

    mysql_close(myconn);
    mysql_library_end();

    return 0;
}
it gives following error :-
Code:
/usr/include/mysql/my_global.h|68|fatal error: my_config.h: No such file or directory
but when in command line by following command :-
Code:
$ gcc -Wall -I/usr/include/mysql main.c -o mysql_c_conn -lmysqlclient
$ ./mysql_c_conn (press enter)
connected successfully
how to do in codeblocks.
 
Old 12-26-2017, 08:16 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Search docs for your IDE on how to add linked libraries?
 
  


Reply

Tags
mysql


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error while building CodeBlocks from source Dober Linux - Software 2 02-23-2013 04:31 PM
error message kernel: be2net 0000:02:00.0: Error in cmd completion - opcode 121, comp slametsu Linux - Server 1 09-27-2012 07:53 AM
Help (codeblocks): error compiling, conio lib? gieseni Programming 2 09-26-2012 10:01 AM
Error in CodeBlocks sujitkulkarni Programming 2 03-16-2011 06:55 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration