c++ - 如何在 Windows 上使用 cproto

标签 c++ c

我有一些冗长的 C 和 CPP 代码文件,并且希望在其中获取函数名称。

我下载了cproto-4.7c-bin.zip到我的 Windows 7 系统并在命令提示符中尝试以下操作:

C:\Users\admin\Desktop\cproto-4.7c-bin\bin>cproto -f fileExec.c
/* stdin */

什么也没发生。它似乎挂起;它显示 /* stdin */ 直到我关闭命令提示符窗口(有效地杀死它)。 C:\Users\admin\Desktop\cproto-4.7c-bin\bin 中的 trace.out 文件为空。

最佳答案

/* stdin */ 消息表示它正在等待 stdin 上的输入。

起初,我找到了原来的,但现在已经不复存在的项目here 。问题中引用的新版本看起来有不错的文档。如果执行cproto --help,它会打印出以下用法语句:

cproto: invalid option -- '-'
usage: cproto [ option ... ] [ file ... ]
Options:
  -a, -t           Convert function definitions to ANSI or traditional style
  -b               Rewrite function definitions in both styles
  -c               Enable comments in prototype parameters
  -e               Output "extern" keyword before global declarations
  -f n             Set function prototype style (0 to 3)
  -l               Generate output in lint-library style
  -o file          Redirect output to file
  -O file          Redirect errors to file
  -p               Disable formal parameter promotion
  -q               Disable include file read failure messages
  -s               Output static declarations also
  -S               Output static declarations only
  -T               Output type definitions
  -v               Output variable declarations
  -x               Output variables and functions declared "extern"
  -m               Put macro around prototype parameters
  -M name          Set name of prototype macro
  -d               Omit prototype macro definition
  -P template      Set prototype format template " int f (a, b)"
  -F template      Set function definition format template " int f (a, b)"
  -C template      Set format for function definition with parameter comments
  -D name[=value]  Define C preprocessor symbol
  -U name          Undefine C preprocessor symbol
  -I directory     Add #include search directory
  -E command       Run specified C preprocessor command
  -E 0             Do not run any C preprocessor
  -V               Print version information

您需要为 -f 选项提供一个额外的参数(或者干脆将其删除)。例如:
C:\Users\admin\Desktop\cproto-4.7c-bin\bin>cproto -f3 fileExec.c

C:\Users\admin\Desktop\cproto-4.7c-bin\bin>cproto fileExec.c

关于c++ - 如何在 Windows 上使用 cproto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37592979/

相关文章:

c++ - 在 C++ 中定义一个不寻常的二维数组

c++ - 解决 std::replace 编译错误

c++ - 如何使用运算符来否定谓词函数!在 C++ 中?

c - 如何用 16 位整数初始化 C 字符串?

将 void 指针转换为结构并将其移动给定大小

android - Libcurl Certificate Pinning 在 iPhone 上工作但在 Android 上不工作

c++ - 为什么在运算符重载中允许返回构造函数?

c++ - malloc 分配的内存可以使用多少时间?

c - C语言中Union的使用方法

c - 使用 lseek 和 write 会导致输入行被附加