Home Corporate Contacts

TETware Knowledgebase


Products
Solutions

Information

Datasheet
Documentation
FAQ
Knowledgebase

Return to Knowledgebase Index

17. How to link the tet_main() function when using the C++ API

 

Question

When I build a child process that contains a tet_main() function, I get the following error messages when from the link stage. I am using MSVC++ version 5.0 on Windows NT.


Linking...
libapi.lib(child.obj) : error LNK2001: unresolved external
symbol _tet_main
Debug/x.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

x.exe - 2 error(s), 18 warning(s)


My program heading looks like this:

int tet_main(int argc, char **argv)
{
	.....
}

Answer

When you use the C++ API, your tet_main() function should have C linkage in order to enable the linker to resolve the symbol correctly. In a C++ program you give a function C linkage by putting it inside an extern "C" code block.

For example:


extern "C" {

	int tet_main(int argc, char ** argv)
	{
		// whatever you want here
	}

}

See also

  • "The C++ API'' in the TETware Programmers Guide.


 


Home Contacts Legal Copyright Corporate News

Copyright © The Open Group 1995-2012, All Rights Reserved