error LNK2001: unresolved external symbol _main。
我写了原文件,头文件(用extern "C" _declspec(dllexport) 函数名这种方式,而不是def)。
不知道哪错了。

解决方案 »

  1.   

    你建立的工程错了吧!编译dll怎么可能需要main?
      

  2.   

    你建的可能是一个控制台工程,简单的方法是重建一个空的dll工程,将代码导入到dll工程中再编译
      

  3.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/lnk2001.aspunresolved external symbol "symbol"Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files.Possible causes What the code asks for doesn't exist (the symbol is spelled incorrectly or uses the wrong case, for example). 
    The code asks for the wrong thing (you are using mixed versions of the libraries, some from one version of the product, others from another version). 
    This error message is followed by fatal error LNK1120.
      

  4.   

    你是显示加载还是隐式加载?
    隐式加载,需要把DLL对应的.LIB引入工程
      

  5.   

    工程类型错了
    应该用win32 application类型
      

  6.   

    用win32 application类型,仍报错。
    Linking...
       Creating library Debug/testdll.lib and object Debug/testdll.exp
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/testdll.exe : fatal error LNK1120: 1 unresolved externals
      

  7.   

    应该是win32 Dynamic-Link Library
    顺便问问有关动态库的问题
    通过vc的dependency看dll时,有些function项有些看上去乱码(@@)的东西是怎么回事。没有头文件,能通过这个工具察看函数的具体参数吗?
    动态库可以相互调用吗?
    动态库里动态分配内存好吗?