LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C MySQL API Weird Problems (https://www.linuxquestions.org/questions/programming-9/c-mysql-api-weird-problems-485781/)

Centinul 09-21-2006 04:17 PM

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.

Wim Sturkenboom 09-21-2006 11:28 PM

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).


All times are GMT -5. The time now is 10:23 AM.