为什么没有libgen.h文件?

wjc870308 2009-04-17 10:02:39
我需要将一段C下的程序改到C++下,可是遇到了没有libgen.h文件的错误,请问该如何修改?谢谢
...全文
1275 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
shexinwei 2011-10-19
  • 打赏
  • 举报
回复 3
09年的帖子。。。。。LZ当年由于一直未解决这个问题,最后被老板开除。找不到工作,已经退出了IT界了。。。。。。
独自听枫 2011-10-19
  • 打赏
  • 举报
回复
赵4老师 2011-10-19
  • 打赏
  • 举报
回复
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _LIBGEN_H
#define _LIBGEN_H

#include <sys/cdefs.h>
#include <sys/types.h>

__BEGIN_DECLS

/* our version of dirname/basename don't modify the input path */
extern char* dirname (const char* path);
extern char* basename(const char* path);

/* special thread-safe Bionic versions
*
* if 'buffer' is NULL, 'bufflen' is ignored and the length of the result is returned
* otherwise, place result in 'buffer'
*
* at most bufflen-1 characters written, plus a terminating zero
*
* return length of result, or -1 in case of error, with errno set to:
*
* ERANGE: buffer is too short
* ENAMETOOLONG: the result is too long for a valid path
*/
extern int dirname_r(const char* path, char* buffer, size_t bufflen);
extern int basename_r(const char* path, char* buffer, size_t bufflen);

__END_DECLS

#endif /* _LIBGEN_H */
赵4老师 2011-10-19
  • 打赏
  • 举报
回复
C:\Android\Mydroid\bionic\libc\include\libgen.h
辰岡墨竹 2011-10-19
  • 打赏
  • 举报
回复
这个库是Gnulib里的,原来的程序应该是Linux/Mac下的吧。
要么你去http://www.gnu.org/s/gnulib/,看到那个Current Gnulib sources了么。
是Git维护的源码仓库,需要用个git客户端下载一份源码拿到VC++里去编译成lib。
要么你就去下一个Cygwin,在它里面用g++开发,肯定有Gnulib这个库,只不过这种方式不能生成纯正的Win32程序。
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 silver9887 的回复:]
大哥,结贴啊
[/Quote]

该结贴了,给点分哦。
silver9887 2010-08-29
  • 打赏
  • 举报
回复
大哥,结贴啊
silver9887 2010-08-29
  • 打赏
  • 举报
回复
libgen.h可能是苹果机下的库,windows的vc库不带这个文件

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧