简体   繁体   English

Visual Studio编译器错误

[英]Visual Studio Compiler Error

I was making a simple DLL as a test in visual studio 2010. Here is the code for SimpleCPP.cpp 我在Visual Studio 2010中做一个简单的DLL作为测试。这是SimpleCPP.cpp的代码

#include iostream
#include "SimpleH.h"

namespace nmspace
{

void myclass::Crap()

{

    std::cout << "Test." << std::endl;

    }

}

Here is the code for the header file 这是头文件的代码

    #include <iostream>
    namespace nmspace
{
        class myclass
    {
    public:
        static __declspec(dllexport) void Crap();
   };
}

My problem is when I compile I get an error that says that visual studio can't find the file SimpleDLLd.dll. 我的问题是,当我编译时出现错误,提示Visual Studio找不到文件SimpleDLLd.dll。 In closer inspection I see that when the program is compiling visual studio adds ad to the release files. 在仔细检查中,我发现在编译程序时,Visual Studio将广告添加到发布文件中。 For example when the DLL is supposed to be SimpleDLL.dll (The project name is SimpleDLL) visual studio adds ad and outputs SimpleDlld.dll. 例如,当DLL被假定为SimpleDLL.dll(项目名称为SimpleDLL)时,Visual Studio将添加广告并输出SimpleDlld.dll。 I tried doing the same thing in another project and it did the same thing. 我尝试在另一个项目中执行相同的操作,但它执行了相同的操作。 I then proceeded to Visual Studio 2013 and copy and pasted the contents of the cpp and header files into new files and surprisingly got the same exact result as Visual Studio 2010. How would I fix this error? 然后,我进入Visual Studio 2013,将cpp和标头文件的内容复制并粘贴到新文件中,令人惊讶地得到与Visual Studio 2010相同的精确结果。我该如何解决此错误? Thank you for responding. 感谢您的回应。

Check the name of the build target in your project file settings. 在项目文件设置中检查构建目标的名称。 The name of the resulting file should be in the Linker->General->Output File setting in the project which is usually $(OutDir)$(TargetName)$(TargetExt) by default. 结果文件的名称应在项目的“链接器”- >“常规”->“输出文件”设置中,默认情况下通常为$(OutDir)$(TargetName)$(TargetExt)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM