Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"unresolved external symbol __sqlResults" 1

Status
Not open for further replies.

andyroo

Programmer
Oct 23, 2001
19
0
0
US
This is a cry for help, i have been dropped in the deep end, not knowing Visual C++ (although the code is actually C) I have been asked to make a change to some code which I can't even get to compile at the moment .. and thats without my changes.

I get an error while linking and don't have a clue where to start, the errors I get are

Linking...
app12b_nt.obj : error LNK2001: unresolved external symbol __sqlepilog
app12b_nt.obj : error LNK2001: unresolved external symbol __sqlResults
app12b_nt.obj : error LNK2001: unresolved external symbol __sqlprolog
app12b_nt.obj : error LNK2001: unresolved external symbol __sqlinitctx
app12b_nt.obj : error LNK2001: unresolved external symbol __sqlsetintrerr
app12b_nt.obj : error LNK2001: unresolved external symbol __sqlctdiag
Release/app12b_ntsrvc.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe


Can somebody give me an idea what I need to do please.

The code starts as embedded SQL, a cp file, which is then pre-complied to a c file and then compiled and linked. I managed to sort out the compliler problems (some include paths missing) but am stuck on this linker problem.

It is using Sybase 12.0 on an NT 4 box. I don't know if the missing bits are in-house written stuff or if they are standard libraries and I don't know how to find out as the only other person here who does C is on holiday.

Any help or advice is much appreciated.

Andy
 
One thing it could be:
If functions (sqlepilog, sqlResults, ...) were compiled with C compiler and you want them to use in C++, you need to declare them as extern "C"...
Example:
Instead of
Code:
void sqlepilog( void* );
use
Code:
extern "C" void sqlepilog( void* );
Or make changes in their header file.

But maybe this is not the reason. :-(
 
Here's some info that maybe helps:


Problem
At link time, the following symbols are listed as undefined:

_sqlctdiag
_sqlinitctx
_sqlprolog
_sqlsetinterr
_sqlepilog

Explanation
There has been a change in the way the include file sybtesql.h is handled between Embedded SQL/C 10.0 and 10.0.1. In release 10.0, the precompiler put the directive #include sybtesql.h at the bottom of the generated .c file. Release 10.0.1 does not do this. The function of that #include is now fulfilled by sybesql.o; if sybesql.o has not been compiled and linked, the symbols listed are unresolved.

Action
Release 10.0.1 contains a file called sybesql.c, located in the include subdirectory of your SYBASE directory tree, which must be compiled and linked in with your programs. This file consists only of these two include statements: #include sybhesql.h and #include sybtesql.h. Make sure that your makefile compiles sybesql.c to produce sybesql.o and links sybesql.o with your application.


:) Hope that this helped! ;-)
 
Well I seem to be getting somewhere ... I have included sybesql.c as part of my "Source Files" and I now only get one error message when linking

app12b_ntsrvc.exe - 1 error(s), 1 warning(s)

.... but there does not seem to be any information as to what the error or warning is.

sybtesql.h and sybhesql.h are included in my "External Dependencies" as well which I assume is correct.

Help so far has been excellent and I really appreciate it - any ideas on the next hurdle ?

Thanks

Andy
:)
 
I take it you just included the two headers in your compile rather than compiling a seperate C module. Is this C or C++? The headers are maybe only meant for C in which case you might have problems compiling with the C++ compiler - see hcexi's comment. I've no idea why you get no actual error message and I have the same trouble as you not knowing what the error actually is! :) Hope that this helped! ;-)
 
The 2 header files were included already when I got hold of the project as part of the "External Dependencies" and it seems like they are automatically included as I can't do a thing with them (but then I might just not know how to !!)

I assume it is C rather than C++ because of the .c extension but then I have never worked with C++.

The project has been compiled and linked before by someone else who has now left the company so there must be a way of getting it to compile - I just need to find the way.

Oh well, thanks all for your help, it was very useful.

Andy
 
If it is possible change header files:
Code:
#ifdef __cplusplus 
extern "C"
{
#endif

// function prototypes for sqlctdiag, ...
void doSomething( void );

#ifdef __cplusplus 
}
#endif
 
Since it's a .c anyway it shouldn't be necessary (although it's maybe not a bad idea). :) Hope that this helped! ;-)
 
There is only 1 header file that has been written as part of the code and the only prototypes in it are to do with functions that have been written as part of the code. All the sql includes are standard Sybase library files which I would rather not touch.

I am fairly certain that I am just missing some set up in the project or an include ... it is just finding the darn thing.

It is also rather iritating that the linker will not tell me what the error is, just that there is one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top