Windows上のTiny Cコンパイラを使用してFile.cをコンパイルして実行します。

StackOverflow https://stackoverflow.com/questions/5031529

質問

Tiny CコンパイラとWindowsプロンプトを使用してFile.cをコンパイルする方法をステップバイステップで取得できますか?

私はすでに持っているいくつかの質問:

  1. ダウンロードからすべてのTCCファイルを固執するのはどこに固執しますか?
  2. PRINTF関数を使用するにはstdio.hをコンパイルする必要がありますか?(私は「こんにちは世界」をやりたいです)

    これは私のfile.cが見えるものです:

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

    ありがとう、


    編集1

    これまでのところ、私はそれを実行してエラーを取得します:file '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