如何编译二进制文件?
我是一名 .net 开发人员,通常编写 Web 应用程序。然而,我已经获得了一个小项目的二进制文件,我需要编译它(我认为)。
它只有两个文件:mfile.h 和 mfile.cpp。从代码来看,.h 文件是包含常量的头文件,而 cpp 文件是实际的代码文件。
我在 Visual Studio Pro 2008 中创建了一个新的 C++ makefile 项目并添加了这些项目,但当我尝试构建它时,只显示 Error 1 Error result -1 returned from ''。老实说
,我以前从未使用过此类代码,但我想编译它并开始学习。我究竟缺少什么?
I'm a .net developer by heart and usually write web applications. However I've been given the binary of a small project and I need to compile it (I think).
It is only two files: mfile.h and mfile.cpp. From looking at the code the .h file is a header file that contains constants and the cpp file is the actual codefile.
I created a new C++ makefile project in Visual Studio Pro 2008 and added these but when I try to build it just says Error 1 Error result -1 returned from ''. Project mfile
I honestly have never worked with this type of code before but I want to compile this and start learning. What exactly am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
希望您运行的是 VS 6,在这种情况下,您只需加载
.cpp
文件,单击“构建”,当它说它将为您创建一个项目时单击“确定”,然后关闭你去。使用 VS 2008,您需要:
现在您应该能够(最终)构建您的项目。
或者,您可以从命令行编译。在开始菜单中转到“Microsoft Visual Studio 8.0”-> “Visual Studio 工具”并选择命令提示符之一。打开后,使用
cd
切换到您存储文件的位置。类型:编译。
Wish you were running VS 6, in which case you'd just load the
.cpp
file, click "build", click "okay" when it says it's going to create a project for you, and off you go.With VS 2008, you want to:
Now you should be able to (finally) build your project.
Alternatively, you can compile from the command line. In the start menu go to "Microsoft Visual Studio 8.0" -> "Visual Studio Tools" and pick one of the command prompts. When it opens, use
cd
to switch to wherever you've stored the files. Type:to compile.
不要创建 makefile 项目,而是创建标准控制台应用程序项目(空)。创建空项目后,添加两个文件并按 F5。如果没有错误或缺少依赖项,一切都应该编译并运行。
Do not create a makefile project but a standard Console application project (empty). After the empty project is created, add the two files and hit F5. If there are no errors or missing dependencies, everything should compile and run.
使用 makefile 项目不是正确的方法(至少对于 Windows 而言)。您应该首先使用向导创建一个新的 C++ 项目。将这些文件添加到创建的解决方案并构建。
Using the makefile project is not the right approach (for windows at least). You should start by using the wizard for a new C++ project. Add those files to the created solution and build.