Kompilieren und führen Sie eine Datei zusammen und führen Sie mit einem kleinen C-Compiler unter Windows zusammen

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

Frage

Ich könnte Schritt für Schritt, um meine Datei zu treten, um meine Datei zu kompilieren.

Einige Fragen, die ich bereits habe:

    .
  1. Wo bleibe ich alle TCC-Dateien aus dem Download?
  2. Muss ich stdio.h kompilieren, um die Druckfunktion verwenden zu können?(Ich möchte eine "Hallo-Welt" machen).

    Dies ist das, wie meine Datei.c aussieht: generasacodicetagpre.

    danke,


    edit 1

    Bislang läuft ich es und erhielt den Fehler: Fügen Sie die Datei 'stdio.h' nicht hinzu.

War es hilfreich?

Lösung

  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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top