簡體   English   中英

Codeblocks IDE C編程-庫沒有提供嗎?

[英]Codeblocks IDE C programming - doesn't come with libraries?

我正在嘗試在CodeBlocks IDE(在Windows上)中創建C程序,我需要的是庫。 當我嘗試構建並運行時,此行錯誤:

#include <sys/times.h>

我該怎么辦? 那是Unix庫嗎? 我可以下載它並以某種方式將其添加到我的CodeBlocks環境中嗎? 我的意思是,已經在那里。

感謝您的任何幫助。

從Code :: Blocks中的Settings > Compiler and Debugger > Compiler Options中刪除-ansi編譯標志。 如果這樣做沒有幫助,則Windows下<sys/times.h>不可用。

編輯sys/times.hPOSIX庫的一部分。 POSIX標頭在MinGW下不可用,需要Cygwin。 time.h是標准的ANSI標頭。 如果要在兼容POSIX的系統上繼續使用sys/times.h ,可以采取以下措施來確保可移植性:

#ifdef __WIN32__
# include <time.h>
#else
# include <sys/times.h>
#endif

參考: time.h

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM