是个用atl编写的控件dll,在debug时可以通过,我想改成release minsize的.dll好发放出去,可是在link的时候报错
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
其中LIBCMT.lib是我要用到fopen函数需要的,我还在.cpp文件中加入了
#include <stdio.h> 这是什么原因呢?dll本来就没有main函数阿
如能解决一定给分

解决方案 »

  1.   

    When building a Release version of an ATL project, indicates that CRT startup code is required. To fix, do one of the following, 
       Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. See General Configuration Settings Property Page for more information. 
       If possible, remove calls to CRT functions that require CRT startup code. Instead, use their Win32 equivalents. For example, use lstrcmp instead of strcmp. Known functions that require CRT startup code are some of the string and floating point functions. 
      

  2.   

    link的選項有問題,是不是設置了輸出exe文件?
      

  3.   

    link参数里有/dll我只用了fopen,fread,这些函数,开始debug build时不用加
    #include <stdio.h> 也通过并且正常执行了
    现在release版的编译的时候就报错,fopen,fread不认识
    我就把stdio.h加上了,就出了问题
      

  4.   

    Remove _ATL_MIN_CRT from the list of preprocessor defines
      

  5.   

    LIBCMT.lib本来就是Multithreaded的,应该不是多线程的问题。你照上面的方法先试试。
      

  6.   

    真的不报错了,太好了,谢谢,马上给分
    可是这个_ATL_MIN_CRT 是干嘛用的呢?
      

  7.   

    This property prevents CRT startup code from being linked with an ATL project. When enabled, it also defines _ATL_MIN_CRT. This will reduce the size of your binary but prevents calling any functions that require the CRT startup code. The Use of ATL property must be set to something other than Not Using ATL in order for Minimize CRT Use in ATL to be in effect.