LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 09-21-2006, 04:17 PM   #1
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
C MySQL API Weird Problems


I'm having some serious issues with my C program that is trying to use the MySQL API. I created an example program that just connects to a mysql database and that works fine. On the other hand when I drop that same code into a more complicated program. The program compiles fine and when I try and run it , it looks like it exits immediately. The MySQL functions don't return any errors and my program won't even produce any output. For example with the MySQL code in my more complicated program if I put a printf statement at the top it doesn't even output when I try and run it. Anyone have any ideas?

Just to make sure this is what I'm compiling it with (I use the pcre library as well):

Code:
gcc complicate_prorgam.c -o complicated_programd -I/usr/local/include -L/usr/local/lib/mysql -lmysqlclient -lpcre
I produce no errors when I compile it using that command.

Any insight? I need to use the C MySQL API to complete this program and I don't understand why it doesn't work when I paste known working code into my program. Thanks.
 
Old 09-21-2006, 11:28 PM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Try to add -Wall after gcc. It will show warnings and might help to find the problem. And in situations like this gdb (the debugger) will be your friend (although I don't know how to use it).
 
  


Reply


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
MySQL C API problem anroy Programming 6 12-07-2006 08:23 PM
mysql client api I_AM Linux - Newbie 1 06-23-2005 11:48 PM
linking C api for mysql toships Programming 3 04-08-2004 11:29 PM
c++ and mysql api nakkaya Programming 4 03-28-2003 11:10 PM
mySQL and C API Problems [RJP]DeanLO Programming 1 11-15-2001 09:16 PM

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

All times are GMT -5. The time now is 02:39 PM.

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
Open Source Consulting | Domain Registration