Home » Developer & Programmer » Precompilers, OCI & OCCI » LNK2001: unresolved external symbol
LNK2001: unresolved external symbol [message #94009] Fri, 22 August 2003 08:20 Go to next message
Erik
Messages: 17
Registered: September 2002
Junior Member
Hi !
I am trying to compile a C++ program that uses OCI but get the
following linker errors. I'm running Oracle 9i on Windows 2000,
compiling with Microsoft
Visual C++ 6.0.

Does anyone know a solution or what I am doing wrong?

Any help would be greatly appreciated. Thanks,

Linking...
server.obj : error LNK2001: unresolved external symbol
_OCIDescriptorFree
server.obj : error LNK2001: unresolved external symbol _OCIHandleFree
server.obj : error LNK2001: unresolved external symbol _OCIInitialize
server.obj : error LNK2001: unresolved external symbol _OCIAttrSet
server.obj : error LNK2001: unresolved external symbol
_OCIServerAttach
server.obj : error LNK2001: unresolved external symbol _OCIHandleAlloc
server.obj : error LNK2001: unresolved external symbol _OCIEnvInit
server.obj : error LNK2001: unresolved external symbol
_OCISessionBegin
server.obj : error LNK2001: unresolved external symbol _OCIErrorGet
server.obj : error LNK2001: unresolved external symbol _OCIStmtPrepare
server.obj : error LNK2001: unresolved external symbol _OCIStmtExecute
server.obj : error LNK2001: unresolved external symbol _OCIAttrGet
server.obj : error LNK2001: unresolved external symbol _OCIBindByName
server.obj : error LNK2001: unresolved external symbol _OCIDefineByPos
server.obj : error LNK2001: unresolved external symbol
_OCIServerDetach
server.obj : error LNK2001: unresolved external symbol _OCISessionEnd
Debug/server.exe : fatal error LNK1120: 16 unresolved externals
Error executing link.exe.
server.exe - 17 error(s), 0 warning(s)
----------------------------------------------------------------
Re: LNK2001: unresolved external symbol [message #94011 is a reply to message #94009] Sat, 23 August 2003 08:16 Go to previous messageGo to next message
Erik
Messages: 17
Registered: September 2002
Junior Member
solved it. need oci.lib in project settings link in Microsoft Visual studio.
Re: LNK2001: unresolved external symbol [message #94060 is a reply to message #94009] Fri, 05 December 2003 03:34 Go to previous messageGo to next message
Alfageme
Messages: 3
Registered: December 2003
Junior Member
Hello Eric!

I have seen your question and i think that i have the same problem. I am trying to compile a C program that uses oci but get the following linker error. I'm running Oracle 9i on Windows 2000, compiling with Microsoft Visual C++ .net.

error LNK2001: unresolved external symbol "int __cdecl orlon(struct cda_def *,unsigned char *,unsigned char *,int,unsigned char *,int,int)" (?orlon@@$$FYAHPAUcda_def@@PAE1H1HH@Z).

1_ I do this: Tools->Options->Projects->VC++ Directories, in the drop down menu titled Show directories for:, select Include files, and then type in the directory for the include file: d:oracleora90ociinclude.
2_ In my program i write:
#include ocidfn.h
#include ocidem.h
#include ociapr.h
#include oratypes.h
3_ And to link i do this: on the main toolbar select Project->Properties->Linker->Input and the "Additional Dependencies" line, add the library (only one): oci.lib.
But after these steps, i get allways the same error.
Can you tell if i don´t use correctly the visual studio .net or if i am not including the right library.

Regards and throw a hand, please.
Re: LNK2001: unresolved external symbol [message #94289 is a reply to message #94009] Thu, 01 July 2004 01:38 Go to previous messageGo to next message
mira
Messages: 1
Registered: July 2004
Junior Member
i have the same problem . if i could resolve it , i'll tell u. and plse if someone give u a hint avout it send me a mail
miraboufarah@hotmail.com
Re: LNK2001: unresolved external symbol [message #94291 is a reply to message #94289] Thu, 01 July 2004 02:08 Go to previous messageGo to next message
Dheeraj Anand
Messages: 5
Registered: May 2004
Junior Member
May be you are missing some libraries....
Can you show your program and tell us what compiling steps you are following?

Dheeraj
Re: LNK2001: unresolved external symbol [message #94293 is a reply to message #94291] Thu, 01 July 2004 17:39 Go to previous messageGo to next message
Jai Vrat
Messages: 20
Registered: June 2004
Junior Member
That is sure that you are missing some libraries. if this symbol/function is provided by Oracle/Pro*C precomp then you can find it in your $ORACLE_HOME. Please search for this symbol in all .a and .so files in this directory.

Or you can search from the same in your projects .a and .so files. Please correct the LD_LIBRARY_PATH environment variable accordingly.

You can refer to sample makefile $ORACLE_HOME/precomp/demo/proc/demo_proc.mk and the env_precomp.mk . These have all the standarad places refereed by precomp.

alternatively.. save this is find.ksh
then use this to find it the missing file to be included.

can chage it for .so --( this is to search symbol in .a files only)
suppose you get error as
undefined symbol sqlcxt
Use it as

./find.ksh sqlcxt

#!/bin/ksh

for file in `find /usr -name "*.a" -print 2>/dev/null`
do
nm $file &#124grep -i fclode 2>/dev/null 1>&2
if [[ $? -eq 0 ]]
then
echo The file is $file
fi

done
Re: LNK2001: unresolved external symbol [message #94331 is a reply to message #94060] Fri, 06 August 2004 08:01 Go to previous messageGo to next message
cybersax
Messages: 1
Registered: August 2004
Junior Member
I've got the same problem, and I have find a solution, it isn't the best, but it's work,
you can add the option /FORCE into Project->Properties->Linker.
It doesn't work the first time, only the second time.
I know that it isn't correct but it's can help somebody.
Re: LNK2001: unresolved external symbol [message #94386 is a reply to message #94011] Thu, 23 September 2004 19:46 Go to previous messageGo to next message
Mark
Messages: 284
Registered: July 1998
Senior Member
I've had this problem and fixed it by selecting project.settings.general Then "Use MFC Classes as shared DLL"...

Hope it helps!
Re: LNK2001: unresolved external symbol [message #94406 is a reply to message #94291] Thu, 14 October 2004 06:08 Go to previous messageGo to next message
Hugo Roberto COLOMBO
Messages: 2
Registered: October 2004
Junior Member
Dear Dheeraj
Really I´m facing this problem again due to a different situation, but one option which could work is to change the LINK.EXE program.

If You got añother solution I´ll be very gratefull with You if You send it to me.

Thank You.

GOOD LUCK!

Hugo COLOMBO
Re: LNK2001: unresolved external symbol [message #94407 is a reply to message #94386] Thu, 14 October 2004 07:29 Go to previous messageGo to next message
Hugo Roberto COLOMBO
Messages: 2
Registered: October 2004
Junior Member
Dear MARK:

I´m sorry, I´d tried it and it didn't work.

It only works if I use a newer link.exe, but I´m needing to use an old one.

equally THANKS

Hugo COLOMBO
Re: LNK2001: unresolved external symbol [message #94420 is a reply to message #94009] Tue, 19 October 2004 23:01 Go to previous messageGo to next message
Mahesh
Messages: 90
Registered: January 2001
Member
its very simple just you include oraSQL9.LIB($ORACLE_HOMEprecomplibmsvc)in Project Settings, Object/library modules...

It will work...
Re: LNK2001: unresolved external symbol [message #94534 is a reply to message #94009] Wed, 12 January 2005 12:28 Go to previous messageGo to next message
Clarence
Messages: 1
Registered: January 2005
Junior Member
I had the same problem in VS NET and resolved it by doing the following:

1) Projects -> Properties
2) Under Configuration Properties:
2a) Click on Linker -> Input, and add 'oci.lib' in Additional Dependencies
3a) Click on C/C++ -> General, and add 'c:oracleora92ocilibmsvc' in Additional Include Directories

Once these are added, the linking completes without an error.
Re: LNK2001: unresolved external symbol [message #109432 is a reply to message #94291] Thu, 24 February 2005 08:34 Go to previous message
Srivalli
Messages: 2
Registered: March 2002
Junior Member
Hello,

Can u help me in solving this problem? please !!!!!!!!

To get the handle of JFrame, i used FindWindow. I used as given below in JNI.

JNIEXPORT void JNICALL
Java_T_Tmanager_init1(JNIEnv *env, jclass cla,jstring str)
{
const char* cw = env->GetStringUTFChars(str, 0);
HWND hwnd = FindWindow(NULL,cw);
env->ReleaseStringUTFChars(str, cw);
InitTwain(hwnd);
}

When i tried to create dll file, it is showing the following error :

TmanagerImpl1.obj : error LNK2001 : unresolved external symbol _imp_FindWindowA@8
sample.dll: fatal error LNK1120 : 1 unresolved externals

How to solve this problem? Help me in solving this.

Thanks,
Sri
Previous Topic: Pro* Cobol : Global temporary tables
Next Topic: how to display info from host structure pointer
Goto Forum:
  


Current Time: Tue Dec 17 23:19:30 CST 2024