Let me just say up front that I'm a complete n00b when it comes to ITK, so I thought it would be a simple matter to start with some preexisting code that's already been successfully compiled into a DLL, but even though I followed the Teamcenter help document about setting up Visual Studio 2010 SP1 for ITK projects, I'm running into a problem that I can't seem to track down. When I build the project I keep running into a single error during the linking step that states:
itk_main.obj : error LNK2019: unresolved external symbol ITK_user_main referenced in function "int __cdecl ms_exception_handling_wrapper(int,char * *)" (?ms_exception_handling_wrapper@@YAHHPEAPEAD@Z)
It seems like it's missing a dependency somewhere, or a library is out of date, but I don't see where. As a test, I created the example project outlined in the help files using one of the sample C code files and it compiled into an executable just fine.
Has anyone here seen this kind of problem and have a suggestion for how to fix it?
It appears that the setup for Visual Studio 2010 shown in Teamcenter 10.x help that I was following is really only appropriate for creating an executable, like a command-line utility, and not for the server extensions in the code I was trying to compile.
After reading further into the help files on ITK customization, which I'll admit I should have done more carefully to begin with, I discovered that there are several linking batch files supplied with the samples and one is for the type of server-side code I had. After setting the environment appropriately I was able to get the code to compile and link successfully.
I'll have to go back through the settings in the link batch files to see what differences there are for the various types of ITK programs I might want to write and see if they can be incorporated into a VS2010SP1 props file. It's just a lot easier to write and build within VS2010SP1 than to have to jump out of it and compile and link on the command line.
This may happens due to missing additional dependencies libraries
try below and pint to %TC_ROOT%
I just got this to successfully link in VS2010SP1 with a little help from Ken Chu at GTAC and a little help from the Internet. It turns out that the example properties file that is shown in Teamcenter's customization help is almost correct for compiling and linking a DLL. What needs to change is:
Hello there, Could you please help me with the same issue here. I believe I have added all the libraries necessary for the user_exits_library file to run, but still getting the below error.
I have seen in one of the posts about having several linking batch files supplied with the samples. In my case, I have only one link_user_exits file, which I am running it currently trying to fix the error.
Can anyone please help me fixing this error.
error LNK2019: unresolved external symbol "__declspec(dl
limport) public: __cdecl std::basic_string<char,struct std::char_traits<char>,cl
ass std::allocator<char> >::basic_string<char,struct std::char_traits<char>,clas
s std::allocator<char> >(class std::basic_string<char,struct std::char_traits<ch
ar>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_tra
its@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV01@@Z) referenced in function "public
: __cdecl std::logic_error::logic_error(class std::basic_string<char,struct std:
:char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@Q
There are three types of DLLs - user exits (not used/recommended anymore), server exits (not used/recommended anymore), and custom exists (preferred).
If you don't see compile.bat and link_custom_exits.bat you may have incomplete installation or you may need to copy sample directory from installation disk.
depending upon how your custom code was written, you will have configure your build scripts.
Further, the error that you see suggests that you may not have visual studio installed properly (or may not be the right version)
Here are the files you should see in the sample folder, along with a bunch of subfolders:
sample | compile.bat | extract_objects.bat | launchPV_MIMEtype_w2k.reg | linkitk.bat | link_custom_exits.bat | link_server_exits.bat | link_user_exits.bat | mapping_tester.exe
If you don't have those files, the extraction failed for some reason.
With regard to the properties required to compile an ITK DLL in Visual Studio 2010, here's the file I used:
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbu
ild/2003"> <PropertyGroup> <_ProjectFileVersion>10.0.40219.1</_ProjectFileVer sion> <_PropertySheetDisplayName>itk_general_dll</_Prope rtySheetDisplayName> <IncludePath>.\;$(VCInstallDir)include;$(VCInstall Dir)atlmfc\include;$(WindowsSdkDir)include;$(Frame workSDKDir)\include;</IncludePath> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> <!-- Replace "TCROOT" with the path to where Teamcenter is installed --> <AdditionalIncludeDirectories>TCROOT\include;TCROO T\include_cpp;%(AdditionalIncludeDirectories)</Add itionalIncludeDirectories> <PreprocessorDefinitions>NT40;POMDLL;CRTAPI1=_cdec l;CRTAPI2=cdecl;_WIN64;WIN64;WIN64_LEAN_AND_MEAN;W NT;BYPASS_FLEX;_INTEL=1;IPLIB=none;%(PreprocessorD efinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> </ClCompile> <Link> <AdditionalOptions>/ignore:4099 /ignore:4199 %(AdditionalOptions)</AdditionalOptions> <AdditionalDependencies>libsyss.lib;libpom.lib;lib tcsso.lib;libae.lib;libappr.lib;libarchive.lib;lib backup.lib;libbom.lib;libcfm.lib;libconstants.lib; libcxpom.lib;libdmi.lib;libecm.lib;libeint.lib;lib epm.lib;libfclasses.lib;libform.lib;libgms.lib;lib grm.lib;libtcinit.lib;libtc.lib;libtccore.lib;libt ctrushape.lib;libinternal_exits.lib;libvalidation. lib;libitk.lib;liblov.lib;libme.lib;libmgc.lib;lib objio.lib;libpie.lib;libai.lib;libproperty.lib;lib ps.lib;libpublication.lib;libqry.lib;libclips.lib; libclipsutil.lib;librbf.lib;libce.lib;libres.lib;l ibsa.lib;libss.lib;libstep.lib;libsub_mgr.lib;libt extsrv.lib;libtie.lib;libnxmgr_im.lib;libaie.lib;l ibics.lib;libeintstub.lib;libsml.lib;libuser_exits .lib;librdv.lib;libcollabctx.lib;libmechatronics.l ib;libtccoreext.lib;libusagewc.lib;libusage.lib;li bcontmgmt.lib;libtc_utils.lib;libschmgt.lib;libsch mgt_bridge.lib;libdocmgt.lib;libdocmgtapp.lib;libv m.lib;libadsfoundationdispatch.lib;libcm.lib;libcm dispatch.lib;libbase_utils.lib;libmld.lib;libfunct ionality.lib;libmfg.lib;libmfgbvr.lib;libtcserveru til.lib;libcondvalidation.lib;libbooleanmath.lib;l ibconfigurator.lib;libfnd0booleansolve.lib;libseco re.lib;libFnd0formulamgmt.lib</AdditionalDependenc ies> <AdditionalLibraryDirectories>TCROOT\lib;%(Additio nalLibraryDirectories)</AdditionalLibraryDirectori es> <DelayLoadDLLs>libtcsso.dll;libict.dll;libae.dll;l ibappr.dll;libarchive.dll;libbackup.dll;libbom.dll ;libcfm.dll;libdmi.dll;libecm.dll;libeint.dll;libe pm.dll;libform.dll;libgrm.dll;libtccore.dll;libtct rushape.dll;libinternal_exits.dll;libitk.dll;libva lidation.dll;liblov.dll;libme.dll;libmechatronics. dll;libmgc.dll;libobjio.dll;libproperty.dll;libps. dll;libpublication.dll;libqry.dll;libres.dll;libst ep.dll;libsub_mgr.dll;libtccoreext.dll;libnxmgr_im .dll;libpie.dll;libai.dll;%(DelayLoadDLLs)</DelayL oadDLLs> <SubSystem>Console</SubSystem> <TargetMachine>MachineX64</TargetMachine> <IgnoreAllDefaultLibraries> </IgnoreAllDefaultLibraries> </Link> <Midl> <TargetEnvironment>X64</TargetEnvironment> </Midl> </ItemDefinitionGroup> </Project>
This properties file is for a 64bit DLL, and as noted in the comment, you'll have to replace "TCROOT" with the path to your Teamcenter installation. Copy into a file and save it as "itk_general_dll.prop" and place it in your VS2010 project folder.
The last issue I ran into was to correctly configure the VS2010 project as a DLL and not an application (.exe). To do that, go to Project Properties (RMB the project in the Solutions pane and select Properties from the context menu) -> Configuration Properties -> General -> Configuration Type.
Make sure the type is set to "Dynamic Library (.dll)".
I have a problem linking an ITK sample batch program.
I have compiled the program successfully. However when i do a linking I'm getting the following error.
#./sample/linkitk -o sample2 sample.o
Executable file will be: sample2
Linking against files : sample.o
/bin/ld: warning libicudata341.so, needed by /home/tcuser/shared/lib/libuser_exits.so, not found (try using -rpath or -rpath-link)
/bin/ld: /home/tcuser/shared/lib/itk_main.o: undefined reference to symbol '_ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3
collect2:error: Id returned 1 exit status
I've copied the TC libraries and inculde files to my Linux machine. There is no Teamcenter installation other than these libraries and other files copied and I have set all teh environment variables required.
Here by attaching my linkitk script.