This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
addrecord.c:(.text+0x191): undefined reference to `strmov'
- From: "vinod" <vinod dot nanjaiah at gmail dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 14 Oct 2009 13:25:24 +0800
- Subject: addrecord.c:(.text+0x191): undefined reference to `strmov'
Hi
When I compile my code :
root@acer:~# gcc -o addrecord $(mysql_config --cflags) addrecord.c
$(mysql_config --libs)
addrecord.c: In function 'main':
addrecord.c:48: warning: incompatible implicit declaration of built-in
function 'exit'
addrecord.c:56: warning: incompatible implicit declaration of built-in
function 'exit'
/tmp/ccS06Hax.o: In function `main':
addrecord.c:(.text+0x191): undefined reference to `strmov'
collect2: ld returned 1 exit status
but it's didn't output createtable exe , what's happening ?
It's my code :
/*-------AddRecords.c---------*/
/*
* MYSQL *mysql_init(MYSQL *mysql)
* MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char
*user, const char *passwd, const char *db,
* unsigned int port, const char *unix_socket, unsigned int client_flag)
* char *mysql_error(MYSQL *mysql)
* int mysql_select_db(MYSQL *mysql, const char *db)
* int mysql_real_query(MYSQL *mysql, const char *query, unsigned long
length)
* char *strmov(register char *dst, register const char *src)
*
* */
#ifdef WIN32
#include <windows.h>
#include <winsock.h>
#pragma warning (disable: 4514 4786)
#pragma warning( push, 3 )
#endif
#include <stdio.h>
#include <string.h>
#include "mysql.h"
#ifndef WIN32
#include <unistd.h>
#endif
/*helper fuction */
int mysql_exec_sql(MYSQL *mysql,const char *create_definition)
{
return
mysql_real_query(mysql,create_definition,strlen(create_definition));
}
int main(int argc, char **argv)
{
MYSQL mysql;
char record[1000];
printf("\n\n\tCopyright Aftab Jahan
Subedar\n\t\thttp://www.geocities.com/jahan.geo");
printf("\n\t\tjahan@geocities.com
\n\t\tPhone:+88027519050\n\t\tsupport:jahan@bol-online.com\n");
if(mysql_init(&mysql)==NULL)
{
printf("\nFailed to initate MySQL connection");
exit(1);
}
/*now you can call any MySQL API function you like*/
if (!mysql_real_connect(&mysql,"
DhakaStockExchangeGame","Dhaka","Dhakapwd",NULL,0,NULL,0))
{
printf( "Failed to connect to MySQL: Error: %s\n", mysql_error(&mysql));
exit(1);
}
if(mysql_select_db(&mysql,"vqm" )==0)/*success*/
printf( "Database Selected\n");
else
printf( "Failed to connect to Database: Error: %s\n",
mysql_error(&mysql));
strmov(record,"INSERT INTO measurement
VALUES('user1','user2','choice',0.333,0.834,0,91.111,0.04999,'2009-09-23
10:10:11')");
if(mysql_exec_sql(&mysql,record)==0)/*success*/
printf( "Record Added\n");
else
printf( "Failed to add records: Error: %s\n", mysql_error(&mysql));
mysql_close(&mysql);
}
any help well be appreciated !
vinod