编译和使用Windows上的微小的C编译器运行file.c中 [英] Compile and run a file.c using Tiny C Compiler on Windows

查看:187
本文介绍了编译和使用Windows上的微小的C编译器运行file.c中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能得到一个循序渐进的有关如何使用微小的C编译器和Windows提示编译我file.c中一步?

一些问题我已经有:


  1. 从何处下​​载坚持所有TCC文件?

  2. 请我一定要编译stdio.h中使用printf函数? (我喜欢做的'Hello World')

这是我的file.c中的样子:

  //的#include<&stdio.h中GT; //像printf诠释主要(无效){
的printf(你好,埃里克你编译和运行程序\\ n!);
}

谢谢,


修改1

到目前为止,我运行它,并得到错误:包含文件'stdio.h中找不到。


解决方案

  1. 你把任何你喜欢的文件。


  2. 没有,你不需要编译 stdio.h中,以使用的printf()功能。


台泥分布(TCC-0.9.25-Win32的BIN \\ TCC)组成的:

  tcc.exe
 tiny_impdef.exe
 tiny_libmaker.exe
 包括\\
   stdio.h中...
 LIB \\
   libtcc1.a ...
 DOC \\
 例子\\

如果你不撕顺序分开,台泥应该工作的开箱(我编译hello.c的一秒钟前)。如果你分开的文件或别的东西不工作:

 %tcc.exe -ipath /到/包括/文件夹/中/ Input.c中-L /路径/要/ lib目录/文件夹/的TCC /

通过查看台泥来源$ C ​​$ C,我发现这个:

  / *在Win32中,我们假设lib和包括处于位置
   tcc.exe的* /焦炭路径[1024],* P;
GetModuleFileNameA(NULL,路径,路径的sizeof);
p值= tcc_basename(normalize_slashes(strlwr(路径)));

所以,每默认它假定库和头是在地方旁边的 tcc.exe

Could I get a step by step on how to compile my file.c using Tiny C Compiler and Windows prompt?

Some questions I already have:

  1. Where do I stick all TCC files from the download?
  2. Do I have to compile stdio.h to use the printf function? (I'd like to do a 'Hello World').

This is what my file.c looks like:

// #include <stdio.h> // for printf 

int main(void){
printf("Hello Eric. You've compiled and run the program!  \n");
}

Thanks,


EDIT 1

So far I'm running it and getting the error: include file 'stdio.h' not found.

解决方案

  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.

这篇关于编译和使用Windows上的微小的C编译器运行file.c中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆