Urgent Problem with Pre-compiler
Posted by: Nikolaos V
Date: June 07, 2008 12:21PM
Date: June 07, 2008 12:21PM
Dear Sir,
I have written a MySQL client using embedded SQL in C. I tried to pre-compile it using your script
http://caixamagica.telepac.pt/pub/mysql/tech-resources/articles/precompiler-for-embedded-sql.html
so that I can compile the output with gcc. MySQL when fully installed has a C API that can make programs interact with the DB Server.
The output c code that comes out from your script gives me errors when compiled with gcc.
So I tried to compile the code included in your article.
I first run the awk file like this:
gawk -f e2mysql.awk sql.e > sql.c
where sql.e is your code
Then I run the mysql_config script to find the libraries in my system
CFG=/usr/local/mysql/bin/mysql_config
sh -c "gcc -o executable `$CFG --include` sql.c `$CFG --libs`"
When I run the mysql_config I get
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/mysql/include/mysql]
--include [-I/usr/local/mysql/include/mysql]
--libs [-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm]
--libs_r [-L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread]
--socket [/tmp/mysql.socket]
--port [3306]
--version [5.0.51b]
--libmysqld-libs [-L/usr/local/mysql/lib/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]
After the gcc I get the messages:
e2mysql.h:35:21: error: stdexcept: No such file or directory
In file included from 1.c:2:
e2mysql.h:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘connectionMade’
e2mysql.h: In function ‘BEGINTRANSACTION’:
e2mysql.h:99: error: parameter name omitted
e2mysql.h:101: error: ‘try’ undeclared (first use in this function)
e2mysql.h:101: error: (Each undeclared identifier is reported only once
e2mysql.h:101: error: for each function it appears in.)
e2mysql.h:102: error: expected ‘;’ before ‘{’ token
e2mysql.h: In function ‘ENDTRANSACTION’:
e2mysql.h:117: error: ‘try’ undeclared (first use in this function)
e2mysql.h:118: error: expected ‘;’ before ‘{’ token
e2mysql.h: In function ‘RESUMETRANSACTION’:
e2mysql.h:131: error: parameter name omitted
e2mysql.h: In function ‘ABORTTRANSACTION’:
e2mysql.h:139: error: ‘try’ undeclared (first use in this function)
e2mysql.h:140: error: expected ‘;’ before ‘{’ token
e2mysql.h: In function ‘getJulianTimeStamp’:
e2mysql.h:155: warning: integer constant is too large for ‘long’ type
e2mysql.h:160: warning: initialization makes pointer from integer without a cast
e2mysql.h:162: error: ‘static_cast’ undeclared (first use in this function)
e2mysql.h:162: error: expected expression before ‘int64_t’
e2mysql.h: At top level:
e2mysql.h:169: error: expected ‘)’ before ‘:’ token
e2mysql.h:182: error: expected ‘)’ before ‘:’ token
e2mysql.h:196: error: expected ‘)’ before ‘:’ token
e2mysql.h:209: error: expected ‘)’ before ‘:’ token
e2mysql.h:222: error: expected ‘)’ before ‘:’ token
e2mysql.h:235: error: expected ‘)’ before ‘:’ token
e2mysql.h:248: error: expected ‘)’ before ‘:’ token
e2mysql.h:261: error: expected ‘)’ before ‘:’ token
e2mysql.h:274: error: expected ‘)’ before ‘:’ token
e2mysql.h:291: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:316: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:323: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:330: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:337: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:344: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:355: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:362: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
1.c:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘csr1’
1.c:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘open_csr1’
1.c:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fetch_csr1’
1.c:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘close_csr1’
1.c: In function ‘main’:
1.c:92: error: ‘hostvar1’ undeclared (first use in this function)
1.c:98: error: ‘rc’ undeclared (first use in this function)
1.c:91: warning: return type of ‘main’ is not ‘int’
Is there a problem with my system, or am I doing something wrong?
Thank you in advance
Nikos V.
Edited 2 time(s). Last edit at 06/07/2008 12:35PM by Nikolaos Vlisidis.
I have written a MySQL client using embedded SQL in C. I tried to pre-compile it using your script
http://caixamagica.telepac.pt/pub/mysql/tech-resources/articles/precompiler-for-embedded-sql.html
so that I can compile the output with gcc. MySQL when fully installed has a C API that can make programs interact with the DB Server.
The output c code that comes out from your script gives me errors when compiled with gcc.
So I tried to compile the code included in your article.
I first run the awk file like this:
gawk -f e2mysql.awk sql.e > sql.c
where sql.e is your code
Then I run the mysql_config script to find the libraries in my system
CFG=/usr/local/mysql/bin/mysql_config
sh -c "gcc -o executable `$CFG --include` sql.c `$CFG --libs`"
When I run the mysql_config I get
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/mysql/include/mysql]
--include [-I/usr/local/mysql/include/mysql]
--libs [-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm]
--libs_r [-L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread]
--socket [/tmp/mysql.socket]
--port [3306]
--version [5.0.51b]
--libmysqld-libs [-L/usr/local/mysql/lib/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]
After the gcc I get the messages:
e2mysql.h:35:21: error: stdexcept: No such file or directory
In file included from 1.c:2:
e2mysql.h:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘connectionMade’
e2mysql.h: In function ‘BEGINTRANSACTION’:
e2mysql.h:99: error: parameter name omitted
e2mysql.h:101: error: ‘try’ undeclared (first use in this function)
e2mysql.h:101: error: (Each undeclared identifier is reported only once
e2mysql.h:101: error: for each function it appears in.)
e2mysql.h:102: error: expected ‘;’ before ‘{’ token
e2mysql.h: In function ‘ENDTRANSACTION’:
e2mysql.h:117: error: ‘try’ undeclared (first use in this function)
e2mysql.h:118: error: expected ‘;’ before ‘{’ token
e2mysql.h: In function ‘RESUMETRANSACTION’:
e2mysql.h:131: error: parameter name omitted
e2mysql.h: In function ‘ABORTTRANSACTION’:
e2mysql.h:139: error: ‘try’ undeclared (first use in this function)
e2mysql.h:140: error: expected ‘;’ before ‘{’ token
e2mysql.h: In function ‘getJulianTimeStamp’:
e2mysql.h:155: warning: integer constant is too large for ‘long’ type
e2mysql.h:160: warning: initialization makes pointer from integer without a cast
e2mysql.h:162: error: ‘static_cast’ undeclared (first use in this function)
e2mysql.h:162: error: expected expression before ‘int64_t’
e2mysql.h: At top level:
e2mysql.h:169: error: expected ‘)’ before ‘:’ token
e2mysql.h:182: error: expected ‘)’ before ‘:’ token
e2mysql.h:196: error: expected ‘)’ before ‘:’ token
e2mysql.h:209: error: expected ‘)’ before ‘:’ token
e2mysql.h:222: error: expected ‘)’ before ‘:’ token
e2mysql.h:235: error: expected ‘)’ before ‘:’ token
e2mysql.h:248: error: expected ‘)’ before ‘:’ token
e2mysql.h:261: error: expected ‘)’ before ‘:’ token
e2mysql.h:274: error: expected ‘)’ before ‘:’ token
e2mysql.h:291: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:316: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:323: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:330: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:337: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:344: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:355: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
e2mysql.h:362: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
1.c:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘csr1’
1.c:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘open_csr1’
1.c:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fetch_csr1’
1.c:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘close_csr1’
1.c: In function ‘main’:
1.c:92: error: ‘hostvar1’ undeclared (first use in this function)
1.c:98: error: ‘rc’ undeclared (first use in this function)
1.c:91: warning: return type of ‘main’ is not ‘int’
Is there a problem with my system, or am I doing something wrong?
Thank you in advance
Nikos V.
Edited 2 time(s). Last edit at 06/07/2008 12:35PM by Nikolaos Vlisidis.
Subject
Views
Written By
Posted
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.