我在向导生成的工程(有MFC支持)中添加了头文件和程序文件,
但编译时提示有错误:
 missing ";" before identifier "Delete"
Delete是我的一个函数
还有 unexpected end of file found怎么办啊?

解决方案 »

  1.   

    这与静态库没有联系吧?难道动态库时没问题?可能Delete函数声明有问题?
      

  2.   

    帮我看一下吧,就这些东西。
    mylib.h#ifndef _MYLIB_H
    #define _MYLIB_H
    BOOL DeleteTree(CString DirName);
    #endifmylib.cpp
    #include <direct.h>BOOL DeleteTree(CString DirName)
    {
    BOOL Result;
    return Result;
    }为什么错误呢?
      

  3.   

    给人的感觉好象你是要定义一个全局函数。而且包含了stdafx.h没有?我估计你那样仍然可能出问题。你试试这样:
    mylib.h
    extern BOOL DeleteTree(CString DirName);mylib.cpp#include "stdafx.h"
    BOOL DeleteTree(CString DirName)
    {
    BOOL Result;
    return Result;
    }
      

  4.   

    呵,这就成了!
    我试了一下,可以。 不过 stdafx.h 是从 MFC console 程序复制过来的。
    我想知道
    这个文件里最少需要什么语句呢?
      

  5.   

    你的MFC程序为什么会没有stdafx.h?我上面说的是MFC中定义全局函数。现在看来也许你需要的只是在mylib.cpp中
    #include "mylib.h"即:
    mylib.h#ifndef _MYLIB_H
    #define _MYLIB_H
    BOOL DeleteTree(CString DirName);
    #endifmylib.cpp
    #include "mylib.h"BOOL DeleteTree(CString DirName)
    {
    // BOOL Result;
    return TRUE;
    }不知mylib在你的工程中用来干什么,总之别人很难猜测你的意思。你还是自己慢慢考虑了。