Subject compiling embeded sql (real newbie)
Author Stanislav Kunc
Hi,

I am in this situation:

Windows 2000.
MinGW compiler is in directory: C:\Temp\Dev-C++\bin\
Firebird 1.5 is unzipped in directory: C:\Temp\firebird\

Firebird is running (isql too), I call gpre:
gpre -m -n -user sysdba -password masterkey newbie.e

where newbie.e looks like this:

file newbie.e
------------------------
#include <stdlib.h>
#include <ibase.h>

EXEC SQL
SET DATABASE DB1 = 'employee.fdb';

int main() {

BASED_ON phone_list.EMP_NO emp_id;

EXEC SQL
CONNECT DB1;

EXEC SQL
SELECT MAX(EMP_NO)
INTO :emp_id
FROM phone_list;

EXEC SQL
DISCONNECT ALL;


return 0;

}
--------------------------

gpre produced newbie.e. So far, so good.
Now I wrote this ugly makefile:

----------
CPP = gcc


newbie.exe:
$(CPP) newbie.c \
-IC:\Temp\firebird\include -IC:\Temp\Dev-C++\include \
-LC:\Temp\firebird\bin -LC:\Temp\firebird\lib
---------


Trying make it:

---------------------------
C:\Temp\Dev-C++\bin>make
gcc newbie.c -LC:\Temp\firebird\bin -LC:\Temp\firebird\lib -IC:\Temp\firebird\in
clude -IC:\Temp\Dev-C++\include
newbie.c: In function `main':
newbie.c:116: warning: passing arg 6 of `isc_attach_database' discards
qualifier
s from pointer target type
C:\Temp\cc2jaaaa.o(.text+0xb9):newbie.c: undefined reference to `isc_attach_data
base@24'
C:\Temp\cc2jaaaa.o(.text+0xc9):newbie.c: undefined reference to `isc_sqlcode@4'
C:\Temp\cc2jaaaa.o(.text+0xfa):newbie.c: undefined reference to `isc_compile_req
uest2@20'
C:\Temp\cc2jaaaa.o(.text+0x11c):newbie.c: undefined reference to `isc_start_requ
est@16'
C:\Temp\cc2jaaaa.o(.text+0x129):newbie.c: undefined reference to `isc_sqlcode@4'

C:\Temp\cc2jaaaa.o(.text+0x158):newbie.c: undefined reference to `isc_receive@24
'
C:\Temp\cc2jaaaa.o(.text+0x168):newbie.c: undefined reference to `isc_sqlcode@4'

C:\Temp\cc2jaaaa.o(.text+0x1b5):newbie.c: undefined reference to `isc_detach_dat
abase@8'
C:\Temp\cc2jaaaa.o(.text+0x1c5):newbie.c: undefined reference to `isc_sqlcode@4'

make: *** [newbie.exe] Error 1
----------------------

I need to link libraries properly, but how?

Any suggestions? Tutorial?

Regards.
S. Kunc (Stanley)