Community
cancel
Showing results for 
Search instead for 
Did you mean: 
maroy
Beginner
55 Views

Linker Warning

warning LNK4248: unresolved typeref token (01000016) for 'RandGaussState_16s'; image may not run

I have Dev Studio 2008 with Parallel Composer Installed.

The programruns and functions as expected.

The data type exposed to the programmer is 'IppsRandGaussState_16s' not 'RandGaussState_16s' so this token would appear to be an internal to the Intel IPP library.

Am I missing something?

Note I get Similar linker errors for:

'RandUniState_32f'

'RandUniState_16s'

'RandGaussState_32f'

0 Kudos
3 Replies
Vladimir_Dudnik
Employee
55 Views

Hello,

could you please specify what version of IPP do you use? Also would be useful to see piee of code where you use IPP structures. One of the common mistakes is misunderstanding that IppsRandGaussState is forward declaration of structure. You can not instantiate object of that type. You only can operate with pointers to this type.

Regards,
Vladimir

maroy
Beginner
55 Views

Library Version: 6.1 build 137.15 Date: Arp 10 2009 Target CPU "v8"

I created a simple example that reproduces the warning. Then I discovered the same sample code will only generate the linker warning if the project has Common Language Runtime Support enabled (/clr) i.e. a C++/CLI project. Both versions work as expected. The GaussNoise class is a pure C++and compiles without change in either environment.

GaussNoise.h

#pragma once

#include "ipps.h"

class GaussNoise

{

public:

GaussNoise(void);

~GaussNoise(void);

bool test();

IppsRandGaussState_16s* pRandGaussState;

};

GaussNoise.cpp

#include "StdAfx.h"

#include "GaussNoise.h"

GaussNoise::GaussNoise(void)

{

pRandGaussState = 0;

IppStatus error = ippsRandGaussInitAlloc_16s( &pRandGaussState, 0, 100, 0);

}

GaussNoise::~GaussNoise(void)

{

if(pRandGaussState)

ippsRandGaussFree_16s(pRandGaussState);

}

bool GaussNoise::test()

{

Ipp16s dest[100];

IppStatus error = ippsRandGauss_16s(dest, 100, pRandGaussState);

if(error == ippStsNoErr)

return true;

return false;

}

Main for C++/CLI

#include "stdafx.h"

#include "GaussNoise.h"

using namespace System;

int main(array<:STRING> ^args)

{

GaussNoise* gn;

gn = new GaussNoise();

if(gn->test())

Console::WriteLine(L"Gauss Noise Generator reports no error");

else

Console::WriteLine(L"Gauss Noise Generator failed");

delete gn;

return 0;

}

Main for C++ only project (no Linker Warning)

#include "stdafx.h"

#include

#include "GaussNoise.h"

int _tmain(int argc, _TCHAR* argv[])

{

GaussNoise* gn;

gn = new GaussNoise();

if(gn->test())

printf("Gauss Noise Generator reports no error");

else

printf("Gauss Noise Generator failed");

delete gn;

return 0;

}

Ying_H_Intel
Employee
55 Views

Hi Maroy,

The code of GaussNoise.cpp and GaussNoise.h looks good, nothingto miss. Do you build the GaussNoise.cpp and GaussNoise.h in a *.NET project ( for example, CLR contral application)?IPP dll is unmanaged native C dll. The option /crl will enable some feature of"managed code".

I did search from the MSDN, the warnmessage"warning LNK4248: unresolved typeref token" seemsbe caused bythat you do not have the exact declaration of the unmanaged class/Structure you are accessing. You may be accessing just a typedef for the same.

for example,
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/5a0e156c-0bdc-4944-a97d-cb6513f75370/

http://social.msdn.microsoft.com/forums/en-us/vclanguage/thread/8376B2F0-CC36-48C8-9021-F30BDA41F410

TheIppsRandGaussState_16s is kind ofinternal structure, only used as pointer, so you get the error whenuse the structurein managed application. Butthe warningshouldnot affect the program run.

And It is not such problem if use the structure in unmanged application, for example, a win32 control application without /crl.

Here is some KB for use IPP in .NET environment:
Using Intel Math Kernel Library and Intel Integrated Performance Primitives in the Microsoft* .NET* ...
Using Intel IPP with different programming languages.

Regards,
Ying