Cообщество разработчиков на платформе Microsoft >
Форумы
>
Visual C++ General
>
LNK1104 cannot find atlthunk.lib with VC++2005xpr and PSDK
LNK1104 cannot find atlthunk.lib with VC++2005xpr and PSDK
- All,
I am trying to compile a modified amcap sample out of the DirectShow fold with VC++ 2005 Express Beta 2 and the 2003 PSDK SP1, targeting 32-bit x86; I don't have any 64-bit stuff installed. OS is Windows 2000 Professional SP4 Rollup 1. After weeding out a number of compilation errors, I am now left with the linker not finding "atlthunk.lib". Right - it does not exist on my harddrive. I am sure that my modifications are irrelevant to this problem; the corresponding version for VC++6 with DirectShow from the DirectX 9.0b SDK compiles and runs fine. I am using the same DXSDK with Express and PSDK.
I appreciate any and all suggestions on how to get that library onto my machine or out of the way.
Cheers, Jochen
Ответы
- Sorry I missed that you have already installed PSDK. I thought you have Express + DirectX but no PSDK installed. But reading this second time, I see that you have different problem. Actually the more important piece of information is that you are trying to target 32bit build with ATL/MFC from PSDK, which only support building 64bit code and/or porting 32bit code built using VC6 to 64bit code. The only way to get 32bit ATL/MFC is Visual Studio, full not Express Edition.
Looks like atlthunk.lib is internal to Windows team library used in 32bit builds. In atlbase.h from PSDK import for this library is in the section of #ifdef _M_IX86, which is 32bit mode for x86 processors. This library is not shipped with any build of PSDK because PSDK does not support using PSDK's version of ATL in 32bit builds. VC version of ATL does not import this library and works fine for 32bit and 64bit.
Sorry one more I did not catch this in my first reply.
Nikola
Все ответы
- Hi,
VC++ Express does not install ATL and MFC. You can install PSDK to get VC6 ATL/MFC and this is what usually folks do to build with DirectX SDK. Take a look on this topic also , http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=2995, and official page for VC++ Express, http://lab.msdn.microsoft.com/express/visualc/default.aspx
Thanks,
Nikola
VC++ - Nikola,
If you look carefully, I have said that I have the PSDK installed. I am using DirectX 9.0b which I had brought onto my machine year for use with VC++6.
When installing VC++2005 Express Beta 2 and the 2003 PSDK SP1, I have skipped all items 64-bit because I don't have any hardware to run 64-bit code on.
There is no atlthunk.lib on my machine anywhere, neither with the beta installation nor with VC++6. The VC++6 version of amcap (more precisely, DirectX 9.0b which still had DirectShow coming with it) does not need it. The source code changes in amcap between DirectX 9.0b and 2003 PSDK SP1 are for the present purposes superficial, all are basically language standard related.
- Yesterday, I have decided to copy the Beta 2 DVD "MS Visual Studio Team Suite" onto my PC over our internal network; I don't have a DVD drive but one of our travel laptops does. Thus I should be able to install Visual Studio 2005 Beta 2 instead of what I have right now. Would that give me a matching(!) copy of ATL and MFC rather than a reduced(?!) VC++6 set?
-Would adding the 64-bit pieces to the Express and PSDK installations give me the missing library?
- Do I have to compile anything (beyond the BaseClasses of DirectShow, which I have taken care of) in the PSDK to get additional libraries that I might need?
Cheers, Jochen - Nikola,
more on this issue.
First, I have removed the "correct answer" checkmark because I think it isn't; from my previous response to you, you can see that I had already done what you suggested.
Second, I found in microsoft.public.platformsdk.base a post (June 8, 2005 by Pawel) suggesting to comment out a pragma in atlbase.h which invokes atlthunk.lib. Recompiling the DirectShow baseclasses and amcap then runs through; there is only a warning re no imports from OleAut.dll left. Whether this quite brutal kludge does the job or not I don't know yet because my test platform with a suitable frame grabber and camera is apart for a while. (Therefore, I will not mark this as the "correct answer" either.) I might add that I have set both MFC and ATL to static linking; this did not have any effect on the occurrence of the error message but serves to make transporting my application easier.
Cheers, Jochen - Sorry I missed that you have already installed PSDK. I thought you have Express + DirectX but no PSDK installed. But reading this second time, I see that you have different problem. Actually the more important piece of information is that you are trying to target 32bit build with ATL/MFC from PSDK, which only support building 64bit code and/or porting 32bit code built using VC6 to 64bit code. The only way to get 32bit ATL/MFC is Visual Studio, full not Express Edition.
Looks like atlthunk.lib is internal to Windows team library used in 32bit builds. In atlbase.h from PSDK import for this library is in the section of #ifdef _M_IX86, which is 32bit mode for x86 processors. This library is not shipped with any build of PSDK because PSDK does not support using PSDK's version of ATL in 32bit builds. VC version of ATL does not import this library and works fine for 32bit and 64bit.
Sorry one more I did not catch this in my first reply.
Nikola - Replace in <atlbase.h> line#294
#pragma comment(lib, "atlthunk.lib")
with
#if _MSC_VER > 1200 //Visual C++ .Net 2002, 32-bit, version 7.0
PVOID __stdcall __AllocStdCallThunk(VOID);
VOID __stdcall __FreeStdCallThunk(PVOID);
#define AllocStdCallThunk() __AllocStdCallThunk()
#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
#pragma comment(lib, "atlthunk.lib")
#else //_MSC_VER <= 1200 Visual C++, 32-bit, version 6.0
#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(), 0, sizeof(_stdcallthunk))
#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
#endif /*_MSC_VER*/
Darko Kolakovic
ddarko - I think you are almost 3 years too late with this post ;-)
- No he didnt. It is just usefull for me today as well as two years ago when i solve this problem first time.
But i just comment out this one line in atlbase.h:
#pragma comment(lib, "atlthunk.lib")

