Tiny C Compiler


Forum: Apps
Topic: Tiny C Compiler
started by: fparri

Posted by fparri on Jan. 11 2004,20:24
Would it be possible to have a newer version in next release of DSL ? I tried a simple hello world, and the stdio.h library is missing :(

< http://fabrice.bellard.free.fr/tcc/changelog.html >

Thanks a million in advance  :;):

Posted by enthusi on Jan. 11 2004,22:32
Hi there :)
DSL does not habe those .h - files
You dont need them anyway.
There is a tcclib.h which includes a lot of them.
You can just copy those you need into it.
Right now I'm writing a little tutorial for TCC and DSL.
try the following:
Code Sample
#include "/usr/lib/tcc/include/tcclib.h"

and compile it with
Code Sample
tcc -o yourfile  -lstdc++-3-libc6.1-2-2.10.0 yourfile.c

That should work.
The .h - files "only" contain the declaration. You can declare them yourself if you like...
Linking them to the correct libs is the important thing!
You can make your own .h-header-file or add needed functions to that tcclib.h

Hope this helped...
Ask again if not... I think TCC is wonderful
and if you are interessted watch out for that little example-proggy I'm gonna post soon :)

Off now,
enthusi

Posted by catfish on Jan. 13 2004,16:40
This is good information. I'm looking forward to your tutorial.

Since you seem to know something about tcc, do you know what  the problem is when compiling a simple "hello world" program results in:
tcc: _start not defined

Thanks,

Posted by enthusi on Jan. 13 2004,17:11
Hi :)
It will be ready soon :)
Your error sounds familiar but I dont remember :(
Maybe you can post or email your c-programm and the command line you use for compiling?
I could test it here then...

Greet's,
Enthusi

Posted by enthusi on Jan. 14 2004,02:04
Hi there :)
I just uploaded a small C/TCC - Tutorial for DSL.
I wrote a small program during christmas when I had nothing with me but my beloved DSL-cd :)
I commented almost every line of the code...
I was quite sceptical about TCC and wanted the good "old" GCC...
TCC may not suit for general source-compilation but it is astonishing powerful for own little projects.
Maybe someone's interessted - please feel free to comment on it. I will start a thread in HOW-TOs. And hopefully you can help me with
comments on how to improve it.
I think it would be nice to add stuff like this (ok, to be honest: please add THIS one :-) to DSL... It takes up almost no space and can add many many fun hours for the DSL-user...

Get it here:
< http://allthegoodthings.tripod.com/damnsmalllinux >

or type:
Code Sample

wget http://allthegoodthings.tripod.com/damnsmalllinux/tcc_tuturial_v0.1.zip

and unzip it...

Good night now,
Enthusi

Posted by catfish on Jan. 14 2004,18:08
Quote (enthusi @ Jan. 13 2004,12:11)
Hi :)
It will be ready soon :)
Your error sounds familiar but I dont remember :(
Maybe you can post or email your c-programm and the command line you use for compiling?
I could test it here then...

Actually I experienced this problem with tcc 0.9.20 on FeatherLinux (which is very similar to DSL).  The code is simply:
Code Sample

#include <tcclib.h>
void main( void )
{
   printf( "hello, world\n" );
}

and compiled with:
Code Sample

tcc -o hello -lstdc++-3-libc6.1.2-2-2.10.0 hello.c

results in "tcc: _start not defined"
(I may not have the library filename correct but you get the idea.) Also compiling with "-c" creates hello.o but the same error occurs when attempting to link and create the executable.
As mentioned this program runs with the tcc "-run" option.
Any ideas are welcome...
Thanks,

Posted by tbeu on Jan. 15 2004,08:04
@enthusi: Am I wrong or is the command line parameter argv[2] never taken into account? I was using Vs 0.1 of your tiny tcc tutorial and I really like it. Well done!

tbeu

Posted by enthusi on Jan. 15 2004,09:01
@theu
damnit! you're right :)
Seems like an version 0.1.1 will be up sooner than I thought.
I inserted the argv[]-options afterwards and obviously forgot one.
argv[2] is menat for ib in line 87.
Just change ib=-1.25 to ib=atof(argv[2]).
Thanks for your comment on this!

@catfish
I will check on this today!
First ideas would be:
- does #include <tcclib.h> work, or does is have to be
#include "/usr/lib/tcc/include/tcclib.h" ?
- a void-main-function is not very common and not necessaryly supported.. Maybe it is only allowed with C++.

But as I said - I will check this out today and hope to be more helpful then

@all
have a nice day,
enthusi

Posted by enthusi on Jan. 15 2004,10:14
Hi again.
@catfish
I just tried and it works fine over here...
sorry
I found a little error though: you mistyped the lib.
-lstdc++-3-libc6.1.2-2-2.10.0
instead of
-lstdc++-3-libc6.1-2-2.10.0
I tried to compile with the latest TCC 0.9.20.
I think it would be best to include the tcclib.h with path.
I dont know FeatherLinux but there SHOULD be no problem...
In general it can be said that
when it runs with "-run" but creates no valdid executable it is not linked correctly to some libs...
I hope this helps even though I told nothing new.
Check for the lib-name and path

good luck,
enthusi

Posted by enthusi on Jan. 16 2004,14:53
Hi folks.
There was one little line to change - so here comes the new version.
Nothing bad but I want to keep up to date.
So better forget the direkt link and just see whats up on this site :
< TCC - Tutorial 16.01.04 v0.1.1 >

Have fun with it and please post wishes of any kidn to me :)
enthusi

Posted by PhrozenFear on Mar. 14 2004,06:58
Now, is this just a c compiler, or can it do c++ as well ?  I'm working with c++, and need a compiler for that, but don't like to have to wait 10 mins for my redhat to boot on my old 233 laptop.
Posted by TyphoonMentat on Mar. 14 2004,17:24
AFAIK, tcc only supports C. Perhaps you'd be interested in uClibc, which has a small C++ compiler as well.
Posted by PhrozenFear on Mar. 19 2004,08:49
Thing is, I don't wanna make my own Knoppix or do an HD-install (not yet anyway).  Besides, gotta find a place that'll teach me how to.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.