Newest PVRlib ( "3.23" ), link error

Just tried to recompile my compression tool, on windows (x86) and linux (x64), using the latest PVRlib ( 3.23 ) got the same link error on windows or linux :








2>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: char const * __thiscall PVRException::what(void)const " (_imp?what@PVRException@@QBEQBDXZ)


2>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall pvrtexlib::CPVRTexture::writeToFile(char const * const)const " (_imp?writeToFile@CPVRTexture@pvrtexlib@@QBEIQBD@Z)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: class pvrtexlib::CPVRTextureData & __thiscall pvrtexlib::CPVRTexture::getData(void)” (_imp?getData@CPVRTexture@pvrtexlib@@QAEAAVCPVRTextureData@2@XZ)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: class pvrtexlib::CPVRTextureHeader & __thiscall pvrtexlib::CPVRTexture::getHeader(void)” (_imp?getHeader@CPVRTexture@pvrtexlib@@QAEAAVCPVRTextureHeader@2@XZ)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::CPVRTexture::CPVRTexture(class pvrtexlib::CPVRTextureHeader &,class pvrtexlib::CPVRTextureData &)” (_imp??0CPVRTexture@pvrtexlib@@QAE@AAVCPVRTextureHeader@1@AAVCPVRTextureData@1@@Z)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::CPVRTexture::CPVRTexture(unsigned int,unsigned int,unsigned int,unsigned int,bool,bool,bool,bool,bool,bool,bool,enum pvrtexlib::PixelType,float,unsigned char *)” (_imp??0CPVRTexture@pvrtexlib@@QAE@IIII_N000000W4PixelType@1@MPAE@Z)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: void __thiscall pvrtexlib::PVRTextureUtilities::CompressPVR(class pvrtexlib::CPVRTextureHeader &,class pvrtexlib::CPVRTextureData &,class pvrtexlib::CPVRTextureHeader &,class pvrtexlib::CPVRTextureData &,bool,int)” (_imp?CompressPVR@PVRTextureUtilities@pvrtexlib@@QAEXAAVCPVRTextureHeader@2@AAVCPVRTextureData@2@01_NH@Z)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::PVRTextureUtilities::~PVRTextureUtilities(void)” (_imp??1PVRTextureUtilities@pvrtexlib@@QAE@XZ)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::PVRTextureUtilities::PVRTextureUtilities(void)” (_imp??0PVRTextureUtilities@pvrtexlib@@QAE@XZ)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: void __thiscall pvrtexlib::CPVRTextureHeader::setPixelType(enum pvrtexlib::PixelType)” (_imp?setPixelType@CPVRTextureHeader@pvrtexlib@@QAEXW4PixelType@2@@Z)


2>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall pvrtexlib::CPVRTextureData::getDataSize(void)const " (_imp?getDataSize@CPVRTextureData@pvrtexlib@@QBEIXZ)


2>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned char * __thiscall pvrtexlib::CPVRTextureData::getData(void)const " (_imp?getData@CPVRTextureData@pvrtexlib@@QBEPAEXZ)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::CPVRTextureData::~CPVRTextureData(void)” (_imp??1CPVRTextureData@pvrtexlib@@QAE@XZ)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::CPVRTextureData::CPVRTextureData(void)” (_imp??0CPVRTextureData@pvrtexlib@@QAE@XZ)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::CPVRTextureData::CPVRTextureData(class pvrtexlib::CPVRTextureData const &)” (_imp??0CPVRTextureData@pvrtexlib@@QAE@ABV01@@Z)


2>main.obj : error LNK2001: unresolved external symbol “__declspec(dllimport) public: __thiscall pvrtexlib::CPVRTexture::~CPVRTexture(void)” (_imp??1CPVRTexture@pvrtexlib@@QAE@XZ)





Any idea ?

Hi olivier,

The latest version of the library is now v4.02 - v3.23 is the last update of the previous major revision, and the API has been updated since this version. The linker errors that you’re having are referring to v3 functions that no longer exist in v4. Are you using the new headers as well as the new library?

The new library uses a new namespace - “pvrtexture::” rather than “pvrtexlib::” to help identify where you need to update your code. It’s worth looking at these issues, and having a read through of the new manual that comes with the library. If you need any help porting over from the old version to the new one please don’t hesitate to ask.

Thanks,

Tobias



Make sense :slight_smile: I just unzipped the update to the folder that was containing the old version, so the previous header were not deleted. Guess Im good for a rewrite of my tool :(.

Ok, I converted my tool to the new PVR library API, a now I have these link error :





2> All outputs are up-to-date.


2>main.obj : error LNK2019: unresolved external symbol “public: virtual __thiscall CPVRTString::~CPVRTString(void)” (??1CPVRTString@@UAE@XZ) referenced in function “bool __cdecl compressBitmap(class Foundation::Bitmap &,class Foundation::Bitmap &,struct Options const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)” (?compressBitmap@@YA_NAAVBitmap@Foundation@@0ABUOptions@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)


2>main.obj : error LNK2019: unresolved external symbol “public: __thiscall CPVRTString::CPVRTString(char const *,unsigned int)” (??0CPVRTString@@QAE@PBDI@Z) referenced in function “bool __cdecl compressBitmap(class Foundation::Bitmap &,class Foundation::Bitmap &,struct Options const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)” (?compressBitmap@@YA_NAAVBitmap@Foundation@@0ABUOptions@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)


2>main.obj : error LNK2001: unresolved external symbol “public: static unsigned int const CPVRTString::npos” (?npos@CPVRTString@@2IB)


2>D:mMapPlatformsWindows…/…/BuildmCompress.Debug.Win32.exe : fatal error LNK1120: 3 unresolved externals





Any idea ?


Thanks in advance.


Hi Olivier,

This is odd, are you using the lib or dll? It should be exposed in each - although looking at the code, the dll may not be exposing it correctly… If this is the case then a simple workaround is to grab “PVRTString.cpp” from our latest SDK and compile it into your project. If you’re using the .lib then this is a more serious problem which I’ll need to look into - though the same workaround should apply.

Thanks,

Tobias



I’m using the DLL version so it might be that. I will try your fix.

Ok, so now it compiles.  But the transcode function fails, and it did not displays any error message ( from the PVRError include,  the lib displays error only in debug build, which your are not providing). I really think that having some feedback over what’s going on is important, any idea how to do that ?


This the code I’m using to convert my data :

    bool hasAlpha = source.getBPP() > 24;
    if (options.compression == Foundation::Bitmap::ETC1) 
        hasAlpha = false;
    
    pvrtexture::CPVRTextureHeader sOriginalTextureHeader( ePVRTPF_RGBG8888,
        source.getWidth(), // u32Width,
        source.getHeight());

    source.fromRGBToRGBA();

    pvrtexture::CPVRTextureHeader sSourceHeader(sOriginalTextureHeader);
    pvrtexture::CPVRTexture       sSource(sSourceHeader, source.getData());
    pvrtexture::PixelType         pvrLibCompression;

    Foundation::Bitmap::Type compression = options.compression;
    if (options.compression == Foundation::Bitmap::PVR2)
    {        
        if (hasAlpha)
        {
            pvrLibCompression = ePVRTPF_PVRTCI_2bpp_RGBA;
            compression = Foundation::Bitmap::PVR2ALPHA;
        }
        else
        {
            pvrLibCompression = ePVRTPF_PVRTCI_2bpp_RGB;
        }
    }
    else if (options.compression == Foundation::Bitmap::ETC1) 
    {
        pvrLibCompression = ePVRTPF_ETC1;
    }
    else if (options.compression == Foundation::Bitmap::S3) 
    {        
#if !defined(LINUX)
        pvrLibCompression = ePVRTPF_DXT1;
        if (hasAlpha)
            compression = Foundation::Bitmap::S3ALPHA;
#endif
    }
    else
    {
        if (hasAlpha)
        {
            pvrLibCompression = ePVRTPF_PVRTCI_4bpp_RGBA;
            compression = Foundation::Bitmap::PVR4ALPHA;
        }
        else
        {
            pvrLibCompression = ePVRTPF_PVRTCI_4bpp_RGB;
        }
    }

    destination.create(source.getWidth(), source.getHeight(), compression);

    if (!pvrtexture::Transcode(sSource, pvrLibCompression, ePVRTVarTypeUnsignedByte, ePVRTCSpacelRGB, pvrtexture::ePVRTCBest))
    {        
        return false;            
    }

    memcpy(destination.getData(), sSource.getDataPtr(), sSource.getDataSize());    
    if (options.outputCompressTextureFile)
    {

        std::stringstream outputFileName;
        outputFileName << input << “_” << textureIndex << “.pvr”;
        sSource.saveFile(outputFileName.str().c_str());
    }

    return true;



Hi Olivier,

PVRError is included only due to a slightly irritating dependency chain which I plan to remove at some point - it has no direct interaction with the library.

The error you're having appears to come from your initial set up, you've used "ePVRTPF_RGBG8888" which is currently not supported by the library, and is probably not the format you were trying to use. RGBG8888 is actually a compressed format which stores a pair of pixels in every 32-bits - it stores two instances of the green channel for this reason. The enum values in that list only refer to compressed formats, anything else is done dynamically.

The format you actually want to use is RGBA8888 I assume? In which case you can use "PVRStandard8PixelType" which is a constant value stored in PVRTextureFormat.h. Any other formats you require should be generated using either the PixelType union also in PVRTextureFormat.h, or the PVRTGENPIXELIDn macros in PVRTTexture.h. Either of these will allow you to generate format identifiers for uncompressed formats. For further information on these I suggest you read through the PVRTexLib manual which goes into slightly more detail.

Currently the only error handling is via the boolean value that pops out as the return value of the function, proper error handling is something that is planned to be added later.

Thanks,

Tobias




Tobias2012-05-10 13:42:52

Thanks it seems to work now :). It’s not really clear in the documentation ( or my brain is maybe not able to process it :slight_smile: ).

anyway I did that :

    pvrtexture::CPVRTextureHeader sOriginalTextureHeader(pvrtexture::PVRStandard8PixelType.PixelTypeID,
        source.getWidth(), // u32Width,
        source.getHeight());

Hi, I ran into somekind of the same issue using the SDK 3.1 and the method “texture.setCubemapOrder(”")".



Trying to add PVRTString.cpp will compile well, but executing the code crashes inside the destructor of CPVRTString. I think this could be a problem with Runtime Libraries I use in my projects and you use in your dll. (E.g. dynamic multi threaded library vs static single threaded library)



Since this seems to be a serios issue, I hope your team already submitted a fixed version? And where would I get this version? :wink:



UPDATE 1: I found out that there is a SDK3.2 Update 1&2 on the imagination site - I am downloading it and hopefully its fixed then :wink:



UPDATE2 : nah! Still got the same errors, even with the latest version: ““public: __thiscall CPVRTString::CPVRTString(char const *,unsigned int)” (??0CPVRTString@@QAE@PBDI@Z)” in Funktion "“bool __cdecl CompressTextureData(unsigned char *,int,int,enum AE3::Texture::AEI_Format,int,unsigned int,char,bool,enum TargetConfigurations::TargetConfiguration::eTextureCompressionQuality,class pvrtexture::CPVRTexture &,class ILog *)” (?CompressTextureData@@YA_NPAEHHW4AEI_Format@Texture@AE3@@HID_NW4eTextureCompressionQuality@TargetConfiguration@TargetConfigurations@@AAVCPVRTexture@pvrtexture@@PAVILog@@@Z)"



UPDATE3: SOLVED !!! You have to check what kind of runtime codegeneration you have. In my project it was set to “Multi Threaded Debug /MTd” - so you I had to use the static version of PVRTexLib - not the dynamic (dll).