MySQL Forums
Forum List  »  Source, Builds, Binaries

MySQL C API and XCode Settings
Posted by: Gregg Green
Date: November 17, 2006 07:57PM

Install MySQL binary from mysql.com

Run XCode and create new project

Edit Project Settings

Search Paths - Header Search Paths
/usr/local/mysql/include
$(inherited)

Search Paths - Library Search Paths
/usr/local/mysql/lib
$(inherited)

Linking - Other Linker Flags
-lmysqlclient
-lm
-lz
$(inherited)

main.h
#include <stdio.h>
#include <mysql.h>
MYSQL mysql;

main.c
#include "main.h"
int mysql_connection(){
mysql_init(&mysql);
if (!mysql_real_connect(&mysql, <host>, <user>, <pwd>, <database>, <port>, NULL, 0)){
// error
} else {
// success
}
return(0);
}

Options: ReplyQuote


Subject
Views
Written By
Posted
12459
October 26, 2005 11:06AM
6461
November 02, 2005 04:54AM
5531
November 14, 2005 02:50AM
4329
February 25, 2006 06:35AM
3989
September 19, 2006 10:23AM
4153
September 25, 2006 03:51AM
MySQL C API and XCode Settings
46540
November 17, 2006 07:57PM
7728
January 22, 2009 06:22AM
4737
January 25, 2009 03:56PM
4436
April 24, 2009 12:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.