Showing results for 
Search instead for 
Did you mean: 

ITK linking error

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

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?

Arden Bedell | Teamcenter Wonk | Applied CAx, LLC

Re: ITK linking error

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

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.

Arden Bedell | Teamcenter Wonk | Applied CAx, LLC

Re: ITK linking error


This may happens due to missing additional dependencies libraries


try below and pint to %TC_ROOT%



Re: ITK linking error

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

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:

  1. Remove the reference to itk_main.obj from the list of additional dependencies, and
  2. Set Project Properties -> Configuration Properties -> General -> Configuration Type to "Dynamic Library (dll)" from the defailt "Application (exe)".


Arden Bedell | Teamcenter Wonk | Applied CAx, LLC

Re: ITK linking error


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

Re: ITK linking error


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)


Thanks and Regards

Yogesh Fegade

Re: ITK linking error

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Here are the files you should see in the sample folder, along with a bunch of subfolders:

|   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="">
	  <!-- Replace "TCROOT" with the path to where Teamcenter is installed -->
      <AdditionalOptions>/ignore:4099 /ignore:4199 %(AdditionalOptions)</AdditionalOptions>

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)".

Arden Bedell | Teamcenter Wonk | Applied CAx, LLC

ITK linking error


Hi ,


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, needed by /home/tcuser/shared/lib/, 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'

/bin/ld:note: '_ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3' is defined in /lib64/ not read symbols:Invalid operation

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.

Re: ITK linking error


Hello Karthi, All library files are configured.

still external link error is coming. could you please give little more details which will help us to solve the issue??

Re: ITK linking error


Pl refer below step by step procedure for Visual Studio setup for ITK,




This is just basic setting, you can change as per your requirement.