lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <va...@apache.org>
Subject Re: Unresolved external symbol errors when linking example native c++ code that uses jcc
Date Thu, 21 Oct 2010 18:20:12 GMT

On Thu, 21 Oct 2010, Imre András wrote:

> JCCEnv.h has the following:
>
> ...
> #ifdef _jcc_shared
> _DLL_IMPORT extern JCCEnv *env;
> _DLL_IMPORT extern DWORD VM_ENV;
> #else
> _DLL_EXPORT extern JCCEnv *env;
> _DLL_EXPORT extern DWORD VM_ENV;
> #endif
> ...
>
> I suspect here is the root of my linker problem. Where should this *env 
> get resolved?

These are in JCCEnv.cpp and jcc.cpp which gets linked with your shared 
library either dynamically (when using --shared) or statically.

You need to link a piece of jcc itself with your code. To get an example 
link line, ask jcc to create a python extension for you, a correct link line 
flies by.

Andi..

>
>
> Thanks,
>  András
>
>
> "Imre András" <iar73@freemail.hu> írta:
>> Hi list,>
>>
> I intend to use jcc to ease calling Java code from native code. I managed to build and
install it. Now I try to build my first test code from within MS VS 2010 Win32 console app
project. Despite setting up the libs and includes I still get linker errors:>
>>
> ------------------------------------------------------------------>
> Link:>
> C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.exe"
/INCREMENTAL /NOLOGO python27.lib _jcc.lib jvm.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Debug\jcc.exe.intermediate.manifest"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.pdb"
/SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.lib"
/MACHINE:X86 Debug\jcc.exe.embed.manifest.res>
> Debug\jcc.obj>
> Debug\stdafx.obj>
> Debug\__wrap__.obj>
> Creating library C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.lib and object
C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.exp>
> 1>jcc.obj : error LNK2001: unresolved external symbol "unsigned long VM_ENV" (?VM_ENV@@3KA)>
> 1>stdafx.obj : error LNK2001: unresolved external symbol "unsigned long VM_ENV" (?VM_ENV@@3KA)>
> 1>__wrap__.obj : error LNK2001: unresolved external symbol "unsigned long VM_ENV"
(?VM_ENV@@3KA)>
> 1>jcc.obj : error LNK2001: unresolved external symbol "class JCCEnv * env" (?env@@3PAVJCCEnv@@A)>
> 1>stdafx.obj : error LNK2001: unresolved external symbol "class JCCEnv * env" (?env@@3PAVJCCEnv@@A)>
> 1>__wrap__.obj : error LNK2001: unresolved external symbol "class JCCEnv * env" (?env@@3PAVJCCEnv@@A)>
> 1>C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.exe : fatal error LNK1120:
2 unresolved externals>
> 1>Done Building Project "C:\out\app\PeldaProgram\ZipBe\bin\test\jcc\jcc.vcxproj" (rebuild
target(s)) -- FAILED.>
>>
> Build FAILED.>
>>
> Time Elapsed 00:00:12.60>
> ------------------------------------------------------------------>
>>
>>
> jni.h and Native2Java.h (jcc generated from the java class I intend to use in native
c++ code) is added to stdafx.h. Now I have no idea where the above symbols come from, and
how should I resolve them.>
>>
>>
> Regards,>
> András>
>>
>
>
Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message