1 Replies - 861 Views - Last Post: 29 January 2013 - 07:12 AM Rate Topic: -----

#1 CountBale  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 22-January 13

mysql_config No such file or directory

Posted 29 January 2013 - 06:54 AM

I wasn't sure whether to post this here, to the mysql forum or to the game dev forum. I am using mysql to add and retrieve high scores from an online database in my C++ program. But whenever I try to compile I get the error "mysql_config No such file or directory" even though I cant find a reference to mysql_config anywhere in my code or headers. I have tried putting mysql_config in the folder with my .exe and it hasn't changed anything.

The section of my code that uses mysql is here:

#include "getScores.h"

extern SDL_Surface *screenSurface;
extern SDL_Surface *menuBackgroundImage;
extern TTF_Font *font;


int getScores()
{
    //A bunch of MySQL pointers
    MYSQL *connection;
    MYSQL_RES *scores;
    MYSQL_ROW row; //Fight the power

    //Some SDL stuff
    SDL_Colour textColour = {255, 255, 255};
    SDL_Surface *scoreText = NULL;
    std::stringstream scoreToPrint;

    //Initialize connection channel
    connection = mysql_init(NULL);
    //Make sure it worked
    if (connection == NULL)
    {
      printf("Failed to initialize sql connection");
      return 1;
    }

    //Establish connection to MySQL database and make sure it works
    if (mysql_real_connect(connection, "mysql13.000webhost.com", "a9916341_40sGame",
         "Cho0Cho0", "a9916341_scores", 0, NULL, 0) == NULL)
    {
        printf("Failed to connect to database");
        return 1;
    }

    //Select table from database
    mysql_query(connection, "SELECT * FROM highScores");
    scores = mysql_store_result(connection);

    //Get the data from the first 10 rows (top 10 scores)
    while ((row = mysql_fetch_row(scores)))
     {
         for(int i = 0; i < 10; i++)
         {
             scoreToPrint << row[i] ? row[i] : "NULL";
             scoreText = TTF_RenderText_Solid(font, scoreToPrint.str().c_str(), textColour);
         }
         printf("\n");
     }

    return 0;
}



The header for this file is:

#ifndef getScores_h
#define getScores_h


#include <winsock.h>
#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_image.h"
#include "mysql.h"
#include <string>
#include <sstream>


int getScores();

#endif



Is This A Good Question/Topic? 0
  • +

Replies To: mysql_config No such file or directory

#2 CountBale  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 22-January 13

Re: mysql_config No such file or directory

Posted 29 January 2013 - 07:12 AM

Oh, before anyone mentions it, I am aware that this wont run. I am away from the computer that has most of my source files so I am just trying to write what I can until I can access the rest of my code. I am just trying to work out why it wont compile.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1