Unable to connecto mysql

In this forum you can discuss database related issues which can be wxWidgets related, but also generic in nature.
Post Reply
amaurisarchibald
In need of some credit
In need of some credit
Posts: 2
Joined: Thu May 15, 2014 5:17 pm

Unable to connecto mysql

Post by amaurisarchibald »

Hi everyone,

I dowloaded and compiled wxWidget sample program.

Everything was working fine, until i tried to add a reference to mysql client library. After adding mysql_config --libs to the gcc linker, the program does compile but it just "freeze" after executing line wxIMPLEMENT_APP(MyApp) .

Here in, I am providing sample program and a sample of compilation command.

I will appreciate any help pls..!!!

Regards,

Amauris

---Comand line compilation from Eclipse
13:56:27 **** Incremental Build of configuration Debug for project convertorImagen ****
make all
Building file: ../src/MyApp.cpp
Invoking: Cross G++ Compiler
g++ -I/usr/include/mysql -I/usr/local/include/wx-3.0 -O0 -g3 -Wall -c -fmessage-length=0 `wx-config --cxxflags` `mysql_config --cflags` -MMD -MP -MF"src/MyApp.d" -MT"src/MyApp.d" -o "src/MyApp.o" "../src/MyApp.cpp"
In file included from /usr/include/assert.h:35:0,
from /usr/local/include/wx-3.0/wx/debug.h:14,
from /usr/local/include/wx-3.0/wx/defs.h:688,
from /usr/local/include/wx-3.0/wx/wxprec.h:12,
from ../src/MyApp.cpp:3:
/usr/include/features.h:327:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
^
Finished building: ../src/MyApp.cpp

Building target: convertorImagen
Invoking: Cross G++ Linker
g++ `wx-config --libs` `mysql_config --libs`-o "convertorImagen" ./src/MyApp.o ./src/example_enconde.o ./src/lodepng.o
Finished building target: convertorImagen


----wxWidget Sample Program
// wxWidgets "Hello world" Program
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#include <wx/menu.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>

#endif


class MyApp: public wxApp
{
public:
virtual bool OnInit();
};


class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
private:
void OnHello(wxCommandEvent& event);
void OnExit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
wxDECLARE_EVENT_TABLE();
};
enum
{
ID_Hello = 1
};

wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Hello, MyFrame::OnHello)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
wxEND_EVENT_TABLE()

wxIMPLEMENT_APP(MyApp);

bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50, 50), wxSize(450, 340) );
frame->Show( true );
return true;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(NULL, wxID_ANY, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
"Help string shown in status bar for this menu item");
menuFile->AppendSeparator();
menuFile->Append(wxID_EXIT);
wxMenu *menuHelp = new wxMenu;
menuHelp->Append(wxID_ABOUT);
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, "&File" );
menuBar->Append( menuHelp, "&Help" );
SetMenuBar( menuBar );
CreateStatusBar();
SetStatusText( "Welcome to wxWidgets!" );
}
void MyFrame::OnExit(wxCommandEvent& event)
{
Close( true );
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxMessageBox( "This is a wxWidgets' Hello world sample",
"About Hello World", wxOK | wxICON_INFORMATION );
}
void MyFrame::OnHello(wxCommandEvent& event)
{
wxLogMessage("Hello world from wxWidgets!");
}
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Unable to connecto mysql

Post by evstevemd »

whil libs do you use for database?
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
amaurisarchibald
In need of some credit
In need of some credit
Posts: 2
Joined: Thu May 15, 2014 5:17 pm

Re: Unable to connecto mysql

Post by amaurisarchibald »

Hi Esteven, tanks for your reply.

I use `mysql_config --libs ` parameter wich calls mysqclient lib.

I did also tried SOCI, but this also need mysqlclient lib.

Regards,

Amauris
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Unable to connecto mysql

Post by evstevemd »

amaurisarchibald wrote:Hi Esteven, tanks for your reply.

I use `mysql_config --libs ` parameter wich calls mysqclient lib.

I did also tried SOCI, but this also need mysqlclient lib.

Regards,

Amauris
try MySQL++ or even (currently shaghalabaghala) library wxDatabase
https://github.com/mtangoo/wxDatabase


Follow thread here: http://forums.wxwidgets.org/viewtopic.php?f=30&t=36133

Still have not find time to make project files
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Post Reply