Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22077

Ubuntu DB2 gcc prep errors on functions slqastrt, sqlacall, sqlastop

$
0
0

I am now attempting to make a simple "create table" C - embedded sql application with gcc.

My sqc file code:

#include <stdio.h>
#include <string.h>
#include <sqlca.h>

/* CREATE A DATABASE TABLE FOR TESTING COBOL-C-DB2 */
/* SQL includes */
  EXEC SQL INCLUDE SQLCA;
  EXEC SQL BEGIN DECLARE SECTION;
  EXEC SQL END DECLARE SECTION;

int main()
{
 EXEC SQL CREATE TABLE SYT006_COUNTRY(
 KEYFIELD                INT NOT NULL,
 SL_ISO2                 CHAR(2) NOT NULL,
 BZ_COUNTRY              CHAR(30) NOT NULL,
 KZ_RISK                 CHAR(1) NOT NULL,
 PRIMARY KEY (KEYFIELD)
 );
return (0);
}

db2 prep does create a C file, setting a path in gcc to DB2s include folder does make for the line #include "sqladef.h" to work for example.

In re-written main function however it calls three functions which I cant find in headers:

#line 25 "create_table.sqc"
sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
#line 25 "create_table.sqc"
sqlacall((unsigned short)24,1,0,0,0L);
#line 25 "create_table.sqc"
sqlastop(0L);

And reports an error:

undefined reference to `sqlastrt'

And after writing -Wl in the gcc line for linking something to something I now get an error message:

 /usr/bin/ld: cannot find : No such file or directory
 collect2: error: ld returned 1 exit status

my script

db2start
db2 connect to sample
db2 prep create_table.sqc bindfile
db2 bind create_table.bnd
gcc -Wl, -Wimplicit -fno-stack-protector -trigraphs create_table.c -o runner - 
I/home/nikica/sqllib/include
./runner

The "runner" executable is not created


Viewing all articles
Browse latest Browse all 22077

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>