Precompiler [message #93486] |
Thu, 07 February 2002 02:10 |
Suparna Saha
Messages: 10 Registered: October 2001
|
Junior Member |
|
|
Hello,
I have written a .PC file and precompile it. It has generated .C file successfully. To make an executable file I run my program from Visual C++. Using Win32 Application I have done this. During Linking it is showing following error.
select.obj : error LNK2001: unresolved external symbol _sqlcxt
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/win_sel.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
win_sel.exe - 3 error(s), 0 warning(s)
SELECT.PC
----------
#include <stdio.h>
#include <sqlca.h>
void sqlerror();
EXEC SQL BEGIN DECLARE SECTION;
char *connstr = "TVD2000/TVD2000@THAI";
char comp_code[[30]], div_code[[30]], acct_code[[30]], acct_name[[50]];
char area_code[[30]], area_name[[50]];
EXEC SQL END DECLARE SECTION;
void main() {
EXEC SQL WHENEVER SQLERROR DO sqlerror();
EXEC SQL WHENEVER SQLWARNING CONTINUE;
EXEC SQL CONNECT :connstr;
EXEC SQL WHENEVER NOTFOUND GOTO notfound;
EXEC SQL SELECT comp_code, divn_code, acct_name
INTO comp_code, div_code, acct_name
FROM t_acct_mast
WHERE acct_code = 'SALES';
found:
printf("company = %s, division = %s, Account = %sn", comp_code, div_code, acct_name);
return;
notfound:
printf("Record not found in database.n");
return;
}
void sqlerror() {
printf("Stop Error:t%25in", sqlca.sqlcode);
return;
}
This program is precompiled successfully. It generates a .C file which contains following line.
static unsigned long sqlctx = 73631115;
I think this line is a problem. If you want I can send you .C file. Please give some solution.
Thanks
|
|
|
|
|