Windows에서 작은 C 컴파일러를 사용하여 file.c를 컴파일하고 실행하십시오.

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

문제

작은 C 컴파일러와 Windows 프롬프트를 사용하여 내 file.c를 컴파일하는 방법을 단계별로받을 수 있습니까?

이미 가지고있는 몇 가지 질문 :

  1. 어디에서 모든 TCC 파일을 다운로드에서 누릅니까?
  2. PRINTF 기능을 사용하려면 stdio.h를 컴파일해야합니까?( '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