我在编译后面的漏洞利用代码时遇到问题:
http://downloads.securityfocus.com/vulnerabilities/exploits/59846-1.c
我正在使用:"gcc file.c"和"gcc -O2 file.c",但它们都会出现以下错误:
sorbolinux-exec.c: In function ‘sc’:
sorbolinux-exec.c:76: error: stray ‘\302’ in program
sorbolinux-exec.c:76: error: stray ‘\244’ in program
sorbolinux-exec.c:76: error: ‘t’ undeclared (first use in this function)
sorbolinux-exec.c:76: error: (Each undeclared identifier is reported only once
sorbolinux-exec.c:76: error: for each function it appears in.)
Run Code Online (Sandbox Code Playgroud)
我尝试在Kali linux和Ubuntu 10.04上编译它们并得到相同的结果.
我正在尝试使用-finput-charset编译器选项在g ++中编译UTF-16BE C++源文件,但我总是遇到一堆错误.更多细节如下.
// main.cpp:
#include <iostream>
int main()
{
std::cout << "Hello, UTF-16" << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
-finput-charset = charset 设置输入字符集,用于从输入文件的字符集转换为GCC使用的源字符集.如果区域设置未指定,或GCC无法从区域设置获取此信息,则默认值为UTF-8.这可以通过语言环境或此命令行选项覆盖.目前,如果存在冲突,命令行选项优先.charset可以是系统的" iconv "库例程支持的任何编码.
g ++ -finput-charset = UTF-16BE main.cpp
我收到了这些错误:
在main.cpp中包含的文件中:1:
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:1:error:stray'\ 342'in program
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:1:error:stray'\ 274'in program
...(反复,很多,大约4000 +)......
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:1:错误:stray'\ 257'在程序中
main.cpp:在函数'int main()'中:
main.cpp:5:错误:'cout'不是'std'的成员
main.cpp:5:错误:'endl'不是'std'的成员
iconv --from-code = UTF-16BE --to-code = UTF-8 --output = main_utf8.cpp main.cpp
按预期生成"main_utf8.cpp"文件.然后我尝试编译它:
g ++ -finput-charset = …
项目运行良好,运行良好,编译良好。直到一些看似随机的时间,它才停止变好。
目前,我遇到了200个流浪错误:
./new:4: error: stray '\376' in program
./new:4: error: stray '\377' in program
./new:5: error: stray '\376' in program
./new:5: error: stray '\377' in program
Run Code Online (Sandbox Code Playgroud)
通过阅读其他文章,似乎我的代码中有一些看不见的坏字符。因此我清空了正在处理的整个文件,但是没有运气。无论我做什么,此错误仍然存在。
同样,在编译main.cpp(首先执行)时,它首先包含#include,这是“ from'file'”消息链的开始。这意味着它还没有真正解析main.cpp的大部分内容,但是却因为读取内部Qt文件而感到厌烦?
我完全在黑暗中凝视着,这可能是什么,我将如何解决?
谢谢!
我正在使用Qt 4.7.2,GCC 4.5.0和Win7。