Home » Developer & Programmer » Precompilers, OCI & OCCI » Precompiler
Precompiler [message #93486] Thu, 07 February 2002 02:10 Go to next message
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
Re: Precompiler [message #93594 is a reply to message #93486] Sat, 20 July 2002 23:12 Go to previous messageGo to next message
zhangwengao
Messages: 1
Registered: July 2002
Junior Member
我办公电话是:010-68765063, 家里是:010-68816810
你的问题很简单:

你应该在你的.pc文件中包含以下列语句:

#include <sqlcpr.h>

这是最重要的, 因为它有相关说明。

祝你好运交个朋友。本人叫张文高!
Re: Precompiler [message #93660 is a reply to message #93486] Wed, 18 September 2002 08:19 Go to previous message
sunmax
Messages: 2
Registered: September 2002
Junior Member
Check your ora*.lib file....
It might be missing.
Previous Topic: How can I connect a remote oracle with pro*c?
Next Topic: Re: user guide to pro*c
Goto Forum:
  


Current Time: Thu Mar 28 11:46:58 CDT 2024