帮助我这个你好的世界计划 [英] Help me with this hello world program

查看:90
本文介绍了帮助我这个你好的世界计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不起作用!



This doesn't work!

#include <iostream>
using namespace std;        // not fond of STDs but never mind

int main()
{
    cout << "What are you upto bebe";
}





请帮忙!!



错误讯息这里 http://i.imgur.com/gvfsURZ.png [ ^ ]



文字版:



Please help!!

Error message here http://i.imgur.com/gvfsURZ.png[^]

Text version:

C:\Users\me\Desktop\console>cl hello.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

hello.cpp
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337) : wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled. S
pecify /EHsc
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hello.exe
hello.obj
LINK : fatal error LNK1104: cannot open file 'libcpmt.lib'

C:\Users\me\Desktop\console>

推荐答案

错误消息是链接器错误,告诉您特定的库可以找不到。



因为要在命令行上进行编译,所以必须设置一些常规环境变量。这可以通过调用应由VS设置生成并存储在 VC\bin 目录中的 vcvars32.bat 脚本来完成。
The error message is a linker error telling you that a specific library can't be found.

Because you are compiling on the command line, you must set some general environment variables. This can be done by calling the vcvars32.bat script which should have been generated by your VS setup and stored in the VC\bin directory.


当你尝试编译它时你会得到
When you try to compile this you get
引用:

致命错误C1010:文件意外结束而寻找预编译的标题。您是否忘记将#includeStdAfx.h'添加到您的来源?

1>

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1>



如果您按照建议解决问题,那就足够了away


Funnily enough if you follow the advice the problem goes away

#include "StdAfx.h"
#include <iostream>
using namespace std;        // not fond of STDs but never mind

int main()
{
    cout << "What are you upto bebe";
}





编辑 - stdafx.h的内容



EDIT - contents of stdafx.h

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>



// TODO: reference additional headers your program requires here


这篇关于帮助我这个你好的世界计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆