标题不知道怎么写好,所以随便写了一个,不够贴切。
问题是这样的,别人给做的一个DLL链接文件(有原代码),我自己在做程序的时候引用他的库,运行时出问题,他的例子程序没事儿。所以想把他的原文件用到我的程序里面(而不是再用链接库),这样好跟踪调试到底哪里出了问题。但单纯把文件考过去编译出错,提示如下:fatal error C1010:unexpected end of file while looking for precompiled header directive.
所以想问问大家如何达到上述功能。
谢谢!

解决方案 »

  1.   

    fatal error C1010:unexpected end of file while looking for precompiled header directive
    可能是需要#include "stdafx.h"。在cpp文件的开头
      

  2.   

    MFC程序都要“include "stdafx.h" ”
      

  3.   

    include "stdafx.h"为了包含一些MFC所使用的一些头文件,最主要的是Windows.h文件
      

  4.   

    还是不行啊,提示:fatal error C1853:'Debug/xxxx.pch' is not a precompiled header file created with this compiler.
    我试着把degug目录删了重新编译也还是不行。
      

  5.   

    #include "stdafx.h" 
    产生预编译头文件
      

  6.   

    你的错误是预编yi错误,可能以前的代码没有使用预编译
    在VC工程设置里有setting->c/c++ 将general改为precompiled head对预编译头进行指定。
    选中stdafx.cpp文件,设置为第三种(create...),空格添stdafx.h
    检查其他cpp文件,quan设为第四种(use....)
      

  7.   

    to: happyparrot(快乐鹦鹉)
    我什么也没做,就是在FileListView里面在SourceFile中右键加入了CPP文件,在HeadFile里面加入了.h文件(不知道这样加进来对不对)。然后在CPP文件头加了#include "stdafx.h"
    to: gmz_whty(一知半解)
    我看了设置,完全符合你说的要求,但还是不对,错误依旧。
      

  8.   

    你需要在那个DLL文件的每个cpp文件里开头第一句加上#include "stdafx.h"
      

  9.   

    HINSTANCE hInst = LoadLibrary("User32.DLL");
    if(!hInst) return FALSE;
    typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD); 
    MYFUNC fun = NULL;
    fun=(MYFUNC)GetProcAddress(hInst,"SetLayeredWindowAttributes");
    if(!fun) return FALSE;
    fun(hwnd,NULL,100,2);//FreeLibrary(hInst)
      

  10.   

    to :mynamelj(风之羽翼)
    你帖的代码什么意思,小弟水平有限,看不懂~~~~~~~~~~
      

  11.   

    HINSTANCE hInst = LoadLibrary("User32.DLL");
    if(!hInst) return FALSE;
    typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD); 
    MYFUNC fun = NULL;
    fun=(MYFUNC)GetProcAddress(hInst,"SetLayeredWindowAttributes");
    if(!fun) return FALSE;
    fun(hwnd,NULL,100,2);//FreeLibrary(hInst)
    ============================================================================以上是一个显式加载DLL的示例