> For the complete documentation index, see [llms.txt](https://beej-zhcn.netdpi.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://beej-zhcn.netdpi.net/introduction/solarissunos_cheng_shi_she_ji_shi_gai_zhu_yi_de_shi.md).

# 1.4. Solaris/SunOS 程序员要注意的事情

当编译 Solaris 或 SunOS 平台的代码时，你需要指定一些额外的命令行参数，以链接（link）正确的库（library）。为了达到这个目的，可以在编译命令後面简单加上＂-lnsl -lsocket -lresolv＂，类似这样：

```shell
$ cc -o server server.c -lnsl -lsocket -lresolv
```

如果还是有错误信息，你可以再加上一个＂-lnext＂到命令行的後端。我不太清楚这样做了什麽事，不过有些人是会这样用。

你可能会遇到的另一个问题是调用 setsockopt()。这个原型与在我 Linux 系统上的不一样，所以可以这样替换：

```c
int yes=1;
```

输入这行：

```c
char yes='1';
```

因为我没有 Sun 系统，所以我无法测试上面的资料，这只是有人用 email 跟我说的。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://beej-zhcn.netdpi.net/introduction/solarissunos_cheng_shi_she_ji_shi_gai_zhu_yi_de_shi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
