每当我构建+运行我的程序时,它会显示所有这些额外的东西:
GNU gdb 6.3.50-20050815(Apple版本gdb-1708)(2011年11月3日星期四21:59:02)版权所有2004 Free Software Foundation,Inc.GDB是免费软件,由GNU通用公共许可证涵盖,你是欢迎在某些条件下更改和/或分发它的副本.输入"show copying"查看条件.GDB完全没有保修.输入"show warranty"了解详情.此GDB配置为"x86_64-apple-darwin".tty/dev/ttys000 [切换到进程3022线程0x0]
你好,世界!
程序以退出代码结束:0
这是Hello World,默认代码:
#include <iostream>
int main (int argc, const char * argv[])
{
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
为什么打印所有额外的东西,我怎么能阻止它?我正在使用Xcode和C++.谢谢.
我开始用Java编程,似乎Eclipse从第一天就给我错误.这是我的问候,世界计划:
public class HelloWorld {
public static void main(String args[]) {
System.out.println(“Hello, World!”);
}
}
Run Code Online (Sandbox Code Playgroud)
但是,每当我尝试运行代码时,println会得到一个红色下划线,并且该行标有红色的"x"符号.Eclipse告诉我" println无法解决".
这种语法与Web上的各种Hello World程序完美排列,以及我正在学习Java的书中的那个.我究竟做错了什么?
我想从不同的类调用python中的方法,如下所示:
class foo():
def bar(name):
return 'hello %s' % name
def hello(name):
a = foo().bar(name)
return a
Run Code Online (Sandbox Code Playgroud)
hello('world')将返回'Hello World'.我知道我在这里做错了什么,有谁知道它是什么?我想这可能是我处理课程的方式,但我还没有理解它.
可以看出,我刚刚开始使用C++,刚开始我的hello world程序.
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << end1;
cout << "Hooray!" << end1;
system("PAUSE");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,我不知道,我在两条cout线路上都出现了错误,说end1是未申报的!我该如何解决?
这是我试图运行的文件,但它只是打开带有页面标题的网页,它不会运行脚本.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html lang=”EN” dir=”ltr” xmlns=”http://www.w3.org/1999/
xhtml”>
<head>
<meta http-equiv=»content-type» content=»text/xml;
charset=utf-8» />
<title>HelloWorld.html</title>
<script type = «text/javascript»>
//<![CDATA[
// Hello, world!
alert(«Hello, World!»);
//]]>
</script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我尝试在aptana和记事本上运行,都没有显示对话框.我觉得我忘记了一个小而重要的部分?
我尝试在 Windows 7 下使用简单的 Hello World 程序测试 MinGW,但出现以下错误:
C:\code\helloworld.cpp:2:2: error: invalid preprocessing directive #INCLUDE
C:\code\helloworld.cpp:3:7: error: expected neested-name-specifier before 'namespace'
C:\code\helloworld.cpp:3:17: error: expected ';' before 'std'
C:\code\helloworld.cpp:3:17: error: 'std' does not name a type
C:\code\helloworld.cpp: In function 'int main()':
C:\code\helloworld.cpp:7:2: error: 'cout' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)
我原来的代码如下:
//Hello, World
#INCLUDE <iostream>
using namesapce std;
int main()
{
cout << "Hello, world!";
return 0;
}
Run Code Online (Sandbox Code Playgroud) 为什么以下代码打印"Hello,world!" (在"我的"系统上)?
.file "test.c"
.globl main
.data
.align 32
.type main, @object
.size main, 56
main:
.value 3816
.value 0
.value 18432
.value 27749
.value 28524
.value 8236
.value 28535
.value 27762
.value 8548
.value -29942
.value 9228
.value 7305
.value -17884
.value 14
.value 0
.value 20818
.value 443
.value 0
.value 21248
.value 1208
.value 0
.value -32000
.value 1260
.value -32563
.value -15229
.value 23312
.value -16335
.value -28477
Run Code Online (Sandbox Code Playgroud)
还有,.value意思是什么,它将如何转化为机器代码?
使用B. Stroustrup的编程文本和关于pg 50的'hello world'程序会产生错误.我有"std_lib_facilities.h"包含文件的问题.
运行后(以root身份)'gcc hworld1.cpp'输出为 -
In file included from /usr/include/c++/4.4/ext/hash_map:60,
from std_lib_facilities.h:34,
from hworld1.cpp:1:
/usr/include/c++/4.4/backward/backward_warning.h:28: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.
/tmp/ccpwXUYx.o: In function `main':
hworld1.cpp:(.text+0x14): undefined reference to `std::cout'
hworld1.cpp:(.text+0x19): undefined reference to …Run Code Online (Sandbox Code Playgroud) 以下代码导致此输出,我无法看到我的文本视图.

我该怎么做才能看到我的文字视图?
它会离开这个闪屏...
提前谢谢.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="hello.agam"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".HelloAndroidActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
我也试过这个:
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
Run Code Online (Sandbox Code Playgroud) 我正在尝试运行一个简单的Hello World!Fedora Linux通过terminal使用程序在系统上gcc,并获得以下内容:
[abder-rahman@Abder Desktop]$ gcc hello.cpp
hello.cpp:1:22: fatal error: iostream.h: No such file or directory compilation terminated.
Run Code Online (Sandbox Code Playgroud)
这是为什么?出了什么问题?
谢谢.
我正在尝试使用here文档并将其存储在变量中.问题在于notepad ++,这里的文档注释了初始化行下面的所有内容,包括PHP文件的结束标记.我究竟做错了什么?
<?php
$html = <<<HTMLBLOCK
Hello world
HTMLBLOCK;
?>
Run Code Online (Sandbox Code Playgroud) 在C++中,我试图理解为什么在构造这样的字符串时不会出现错误:
const string hello = "Hello";
const string message = hello + ", world" + "!";
Run Code Online (Sandbox Code Playgroud)
但你得到一个编译时错误:
const string exclam = "!";
const string msg = "Hello" + ", world" + exclam
Run Code Online (Sandbox Code Playgroud)
编译时错误是:
main.cpp:10:33: error: invalid operands of types ‘const char [6]’ and
‘const char [8]’ to binary ‘operator+’
Run Code Online (Sandbox Code Playgroud)
为什么第一次运行正常但第二次生成编译时错误?
我是C++的新手,我尝试打印'Hello world'.
#include <iostream>
using namespace std;
int main() {
cout << 'Hello world!';
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但结果我得到'1919706145'.我做错了什么?