QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4039|回复: 1

(For newbie)Linux 编程环境常见问题[ZT]

[复制链接]
发表于 2003-6-4 00:24:57 | 显示全部楼层 |阅读模式
刚接触 Linux/UN*X 编程的朋友们对 Linux/UN*X 编程环境和有关工具还不太熟悉。
这里总结有关 Linux/UN*X 编程环境的一些最基本的常见问题。 Hope it helps.


1. a.out 不能运行
2. gdb 不能调试
3. c++ 程序通不过编译
4. undefined reference to 'xxxx'
5. make/Makefile 不能工作


1Q. 我用 gcc hello.c 编译成了 a.out.
但运行 a.out 时,系统提示 "bash: a.out: command not found".

1A. $ ./a.out


2Q. 我用 gdb 调试程序时,无法用 list 命令显示源文件,总是提示 "init.c: No such file or directory"

2A. 编译时加上 -g 选项。


3Q. 我写了个最简单的 "hello, world" 的 c++ 程序,但无法用 gcc编译,
总是有 "undefined reference to `std::cout'" 等错误提示。

3A. 用 g++ 编译 c++ 程序, ie. $ g++ foo.cpp


4Q. 为何编译程序时得到 "undifined reference to 'xxxx'" 错误提示?

4A. 1) 见问题 3。and/or
2) 缺少某个库的连接。(ie. -lpthread, -lcrypt)


5Q. 用 make/Makefile 时,提示 "missing separator. Stop."

5A. Makefile 要求每条命令前都要有 <Tab>. ie,
--------------------------8<--------------------------------
Target: Dependence
<Tab> Command
-------------------------->8--------------------------------


Anything i've missed?



Vim 中文文档
http://vcd.cosoft.org.cn
发表于 2006-10-30 10:33:36 | 显示全部楼层
有心人!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-5-15 06:09 , Processed in 0.085860 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表