在VC中,若用了__declspec(dllexport ) ,就可不用.DEF文件了。.DEF文件主要用于指定程序的输入。
对于C++程序动态链接库,一般都要加上extern "C",以便能为C所调用。

解决方案 »

  1.   

    1.2.DEF文件定义你么输出的函数映射,这是属于老式程序的方式;现在,如果已经在源文件的函数定义中加了__declspec(dllexport),就不需要在DEF文件中在定义了。
       第二个警告和此无关,可能是你引用了其他文件定义的全局函数,你需要将他们用extern修饰。
    3.问题与此应该无关,不知道你是不是在程序中执行了WinExcec()函数。
      

  2.   

    1.*.DEF 定义了DLL的输出函数或输出变量
    2. 
    Compiler Warning (level 1) C4518
    'specifier' : storage-class or type specifier(s) unexpected here; ignored
    For example, the following storage-class specifier locations are invalid and when compiled will cause C4518:__declspec(dllexport) extern "C" void foo();   // Here
       class C {
          int * virtual vfunc();         // And here
       };The following macro will not give the expected results and will result in a C4518:
    extern "C" DLLEXPORT STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
    This macro should be written as:
    STDAPI DLLEXPORT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
    Compiler Warning (level 1) C4502
    'linkage specification' requires use of keyword 'extern' and must precede all other specifiersA linkage was specified without the extern keyword. Linkage is not relevant to non-extern types.
    The compiler assumed the extern keyword.3. 你的系统是否是WIN95/98或者你的NT不是装在C:下?
    修改你PROJECT的SETTINGS,修改c:\winnt\system32\cmd.exe为适当值
      

  3.   

    第二个问题不懂;
    我的文件是这样的:
    __declspec(dllexport) STDAPI DllRegisterServer(void)
    {
    ......
    }
      

  4.   

    第二个问题不懂;
    我的文件是这样的:该怎样解决?
    __declspec(dllexport) STDAPI DllRegisterServer(void)
    {
    ......
    }
      

  5.   

    还是不会!!
    __declspec(dllexport ) 我认为是在编写DLL文件时声明输出的接口以便让其他程序或函数调用的,对吗?另:还是不会处理关于cmd.exe错误
      

  6.   

    To juky:
        对于“__declspec(dllexport ) ”的说法,这样声明是让编译器知道,这个函数是DLL向外输出的,这样呢就可以在别的程序中将这个DLL加载,然后运行这个函数。看名字就应该知道了,不是叫export么?