+ -
当前位置:首页 → 问答吧 → SDL中 callback函数的参数各来自哪里?

SDL中 callback函数的参数各来自哪里?

时间:2010-01-13

来源:互联网

如图
附件:

Screenshot.png [ 667.3 KiB | 被浏览 1687 次 ]

作者: silver924   发布时间: 2010-01-13

hello.c内容发上来看看

作者: chairdog   发布时间: 2010-01-13

可以把iostream改为studio,换成在C语言中的程序也可执行。。。

作者: luofeng1989   发布时间: 2010-01-13

hello.c是这样的
附件:

Screenshot.png [ 611.9 KiB | 被浏览 1662 次 ]

作者: silver924   发布时间: 2010-01-13

因为io.h不是c的,是cpp(c++)的

作者: sweating   发布时间: 2010-01-13

1. 搞清楚 c 和 c++ ,至少要分清 gcc 和 g++

2.找本稍微新一点的c++的书,至少书中要是 #include<iostream>,而不是 #include<iostream.h>

作者: dbzhang800   发布时间: 2010-01-13

dbzhang800 写道:
1. 搞清楚 c 和 c++ ,至少要分清 gcc 和 g++

2.找本稍微新一点的c++的书,至少书中要是 #include<iostream>,而不是 #include<iostream.h>

私以为c++找书不一定好,因为就只是语法的话就那几个点
并且千万别找一本叫做c++ primer plus的书,这本书比c++ primer差很多私以为
如果真的找书还是c++ primer罢........

作者: sweating   发布时间: 2010-01-14

dbzhang800 写道:
1. 搞清楚 c 和 c++ ,至少要分清 gcc 和 g++
2.找本稍微新一点的c++的书,至少书中要是 #include<iostream>,而不是 #include<iostream.h>


gcc 是靠文件名后缀识别文件类型的,用 gcc 编译 c++ 程序并无不妥。只是链接的时候要指定 c++ 库。

只有两种情况下你需要使用 g++:
1。你使用了非标准的文件名后缀:例如你希望把你的 c++ 程序用 .c 结尾。
2。你不知道 c++ 的标准库叫什么名字。

作者: poet   发布时间: 2010-01-14

poet 写道:
gcc 是靠文件名后缀识别文件类型的,用 gcc 编译 c++ 程序并无不妥。只是链接的时候要指定 c++ 库。

这本身就是gcc和g++的区别嘛

poet 写道:
只有两种情况下你需要使用 g++:
1。你使用了非标准的文件名后缀:例如你希望把你的 c++ 程序用 .c 结尾。
2。你不知道 c++ 的标准库叫什么名字。


恩,非标的文件后缀,仍可以用gcc,
gcc -xc++ file1.abc -lstdc++
g++ -xc++ file1.abc

作者: dbzhang800   发布时间: 2010-01-14

非常感谢各位的帮助,iosteam是没问题的了,可是又出现了另一个问题,
hello.cpp: In function ‘int main()’:
hello.cpp:6: error: ‘cout’ was not declared in this scope
hello.cpp:6: error: ‘endl’ was not declared in this scope
这是怎么回事啊

作者: silver924   发布时间: 2010-01-14

silver924 写道:
非常感谢各位的帮助,iosteam是没问题的了,可是又出现了另一个问题,
hello.cpp: In function ‘int main()’:
hello.cpp:6: error: ‘cout’ was not declared in this scope
hello.cpp:6: error: ‘endl’ was not declared in this scope
这是怎么回事啊


std::cout
std::endl

作者: BigSnake.NET   发布时间: 2010-01-14

BigSnake.NET 写道:
silver924 写道:
非常感谢各位的帮助,iosteam是没问题的了,可是又出现了另一个问题,
hello.cpp: In function ‘int main()’:
hello.cpp:6: error: ‘cout’ was not declared in this scope
hello.cpp:6: error: ‘endl’ was not declared in this scope
这是怎么回事啊


std::cout
std::endl


或者用这种语法:
代码:
#include <iostream>

using namespace std;

作者: anticlockwise   发布时间: 2010-01-15

楼主还是买本c++ primer好好看看吧……

作者: liwangli   发布时间: 2010-01-15

anticlockwise 写道:
BigSnake.NET 写道:
silver924 写道:
非常感谢各位的帮助,iosteam是没问题的了,可是又出现了另一个问题,
hello.cpp: In function ‘int main()’:
hello.cpp:6: error: ‘cout’ was not declared in this scope
hello.cpp:6: error: ‘endl’ was not declared in this scope
这是怎么回事啊


std::cout
std::endl


或者用这种语法:
代码:
#include <iostream>

using namespace std;

其实私以为
using std::cout;
using std::endl;
也许更好
不过我还是觉得最好是std::cout和std::endl

作者: sweating   发布时间: 2010-01-16

作者: keppelcao   发布时间: 2010-01-21