我可以通过使用微小的c编译器和windows提示符来逐步逐步逐步编译我的文件和Windows提示符吗?

一些我已经有些问题:

  1. 在哪里可以从下载中坚持所有TCC文件?
  2. 我必须编译stdio.h要使用printf功能吗?(我想做一个'Hello World')。

    这是我的文件看起来的样子:

    // #include <stdio.h> // for printf 
    
    int main(void){
    printf("Hello Eric. You've compiled and run the program!  \n");
    }
    
    .

    谢谢,


    编辑1

    到目前为止,我正在运行它并收到错误:找不到文件'stdio.h'。

有帮助吗?

解决方案

  1. you put the files wherever you like.

  2. no, you do not need to compile stdio.h in order to use the printf() function.

the tcc-distribution (tcc-0.9.25-win32-bin\tcc) consists of this:

 tcc.exe
 tiny_impdef.exe
 tiny_libmaker.exe
 include\
   stdio.h ...
 lib\
   libtcc1.a ...
 doc\
 examples\  

if you do not tear that order apart, tcc should work out of the box (i compiled a hello.c seconds ago). if you separated the files or something else does not work:

% tcc.exe -Ipath/to/include/folder/of/tcc input.c -L/path/to/lib/folder/of/

by looking at the source code of tcc i found this:

/* on win32, we suppose the lib and includes are at the location
   of 'tcc.exe' */

char path[1024], *p;
GetModuleFileNameA(NULL, path, sizeof path);
p = tcc_basename(normalize_slashes(strlwr(path)));

so, per default it assumes the libs and the headers to be in the place right next to the tcc.exe.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top