Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Linking problems while compiling and linking DFT.cpp

Vinod_V_
Beginner
580 Views

I have a cpp file here:

#include "stdafx.h"
#include "ipp.h"
#include "tools.h"

// Calculate FFT and extend CCS representation to full signal
void myDFT_RToC_32f32fc(Ipp32f* pSrc, Ipp32fc*pDst, int len)
{
	IppsDFTSpec_R_32f *pDFTSpec;
	ippsDFTInitAlloc_R_32f( &pDFTSpec, len, IPP_FFT_DIV_INV_BY_N,
		ippAlgHintFast );
	ippsDFTFwd_RToCCS_32f(pSrc, (Ipp32f*)pDst, pDFTSpec, 0 );
	ippsConjCcs_32fc_I(pDst, len);
	ippsDFTFree_R_32f(pDFTSpec);
}

int main(int argc, char* argv[])
{
	int len;
	Ipp32f* pSrc;
	Ipp32fc* pDst;
	Ipp32f* pDstMag;

	for (len=4; len<= 8192; len*=2)
	{
		// Generate a Jaehne signal as source for FFT
		pSrc = ippsMalloc_32f(len);
		pDst = ippsMalloc_32fc(len);
		pDstMag = ippsMalloc_32f(len);
		ippsVectorJaehne_32f( pSrc, len, 1 );

		// Take DFT, calculate magnitude, and display
		myDFT_RToC_32f32fc(pSrc, pDst, len);
		ippsMagnitude_32fc(pDst, pDstMag, len);
		spView_32f( pDstMag,len,"DFT(Source)", 1 );

		ippsFree(pDst);
		ippsFree(pSrc);
		ippsFree(pDstMag);
	}

	return 0;
}

This file is taken from Intel IPP book code.

(I am using icl.exe in windows 7)

When it is tried to link the DFT.obj file with the command xilink DFT.obj,

the following errors are coming:

DFT.obj
DFT.obj : error LNK2019: unresolved external symbol _ippsMalloc_32f@4 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsMalloc_32fc@4 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsVectorJaehne_32f@12 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsDFTInitAlloc_R_32f@16 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsDFTFwd_RToCCS_32f@16 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsConjCcs_32fc_I@8 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsDFTFree_R_32f@4 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsMagnitude_32fc@12 referenced in function _main
DFT.obj : error LNK2019: unresolved external symbol _ippsFree@4 referenced in function _main
DFT.exe : fatal error LNK1120: 9 unresolved externals

What could be the reason for this error message.

I which library _ippsMalloc_32f is defined?

How can I find which function is defined in which library?

0 Kudos
1 Reply
Shenghong_G_Intel
580 Views

The reason for these linking errors is you are not linking to the IPP libraries, which contains the definition of these functions.

In which library _ippsMalloc_32f is defined? How can I find which function is defined in which library?

>> You may check below articles for reference:

https://software.intel.com/en-us/articles/selecting-the-intelr-ipp-libraries-needed-by-your-application

https://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-for-windows-find-the-intel-ipp-libraries-needed-by-your-application

Search in help document and see which domain the function is, and read the article to find the correct library to link.

If you still have issues, I'd like to suggest you to post your question on IPP forum (https://software.intel.com/en-us/forums/intel-integrated-performance-primitives), there are more IPP experts in that forum. Hope it helps.

Thanks,

Shenghong

0 Kudos
Reply