开发者

undefined symbol: mysql_options problem

can't compile a c program on gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)开发者_开发知识库

What should i do?

Thanks.


One thing you could do is provide more information :)
A typical example here would be that you miss an include file from some other package, maybe in /usr/lib/include or /usr/local/lib/include. Either way the compiler does not know what "mysql_options" means.


Undefined symbols are generally functions or variables that cannot be resolved at the final linking stage.

The most common cause is failing to add the object file or shared library that contains them to the compiler/linker options. For example if the shared library is libtest.so you would need to add a -ltest option to gcc, which is usually used for linking on many systems instead of using ld directly.

In many other cases the linker fails to find said libraries because the library search path (-L option in gcc) is not set correctly to allow the linker to find those libraries. In this case, however, the linker would output a separate error message about being unable to find a specified library.

Another, far less common cause is using header files with conditional parts that are not in sync with the actual shared library. As an example, imagine using the unicode versions of the functions in a library, as defined in its header file, while the actual shared library object does not have unicode support and therefore does not include those functions.

In your case the mysql_options symbol is in the libmysqlclient and libmysqlclient_r libraries. You should check the command line that causes the error and see if any of them is being linked in.

If you want more help, though, you should provide us with said command line, the exact error message(s) and some information on what you are trying to compile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜