开发者

compile and link CxImage static lib in VC++

I tried to use CxImage in my project VC++, however I use a walkthrough for create static libs and link with a project in VC++ 2010.

Everything looks fine when I generate the project that link the cximage.lib, but for some reason when I use certain functions the compiler threw me a LINK:2001 unresolved external symbol.

This is the first time I work with visual static libraries, if someone have the solution or a suggest开发者_运维问答ion for this I would be grateful.

here is my code:

    #include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
    CxImage imag;
    imag.Save((const TCHAR *)"hola.bmp",CXIMAGE_FORMAT_BMP);
    return 0;
}

and there it is, CxImage is recognized by the compiler but some functions on the linker not. In this case the function Save, if I used other functions and work, the generation is successful. I searched over the net and find that I could by not including a library but I include it.

The link error is the next:

pruebaCxImage.obj : error LNK2001: símbolo externo "public: bool __thiscall CxImage::Save(wchar_t const *,unsigned int)" (?Save@CxImage@@QAE_NPB_WI@Z) sin resolver

for more information this is the command's of my linker in the project:

/OUT:"C:\Documents and Settings\diego\Mis documentos\Visual Studio 2008\Projects\pruebaCxImage\Release\pruebaCxImage.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"Release\pruebaCxImage.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Documents and Settings\diego\Mis documentos\Visual Studio 2008\Projects\pruebaCxImage\Release\pruebaCxImage.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "..\..\..\..\..\escritorio\cximage701_full\cximage\release\cximage.lib"


You build the exe with UNICODE/_UNICODE defined, since TCHAR expands to wchar_t (see the linker error), so my guess is that you built the lib without defining UNICODE/_UNICODE or didn't add the lib output directory to the list of lib input directories in the exe properties.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜