Compile DLL has error (emergency)

Posted on 2005-04-15
Last Modified: 2013-11-20

When i download these source codes , the demo source is ok .
But my question is that when i download that source code ( "keyhook.cpp && "keyhook.h") and compile it using MFC(DLL) .It didn't work and there is an error

"fatal error C1010: unexpected end of file while looking for precompiled header directive"

Although i have included the library "stdafx.h" in my "keyhook.cpp"

Can anyone will me an help?
Thank you very much
Question by:dtuananh
    LVL 86

    Expert Comment

    You need to put

    #include "StdAfx.h"

    as the 1st line of your .cpp file - VC++ will create it's precompiled headers through that file and therefore needs that directive there.
    LVL 7

    Accepted Solution

    Did you look at his demo project?  The source files are not for MFC (keyhook.cpp includes windows.h). The demo project (which does not use keyhook.cpp) is an MFC project and compiles and runs just fine (at least for me).
    LVL 30

    Expert Comment

    Hi dtuananh,
    You can setup your file so it doesn't need precompile headers.
    You can do this by right clicking the file on your FileView workspace, and then click settings.
    Then click the C++ tab, and change category to Precompiled Headers.
    Then just select "Not Using Precompiled Headers".

    This is a good option to use, if you want to keep the file as-is.

    David Maisonave :-)

    Author Comment

    I have just do all of your opions but i still can not solve the problem .Can anyone try to compile "keyhook.cpp" && "keyhook.h" to DLL file and give me a help ?

    Thank you very much

    Author Comment

    Now i see my error .These two file is for Win32 DLL not MFC DLL

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
    Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now