tcc / c library problem

Forum: Programming and Scripting
Topic: tcc / c library problem
started by: kilmister_2

Posted by kilmister_2 on Oct. 18 2006,11:57
Hi everyone,

I am at my first post on this forum.
I am new to DSL and have installed DSL to Hard Disk on a laptop; while tring to compile with tcc (the typical "hello world!") I got an error message saying " include file stdio.h not found"
I checked the /usr/include dir and infact there was no stdio.h file.
Are C libraries located in a different directory in dsl? Do I need to install any additional package?
Thanks in advance.

Posted by clacker on Oct. 18 2006,12:19
tcc is funny that way, you need to use tcclib.h instead of stdio.h, like so:

Code Sample
#include <tcclib.h>

int main(int argv, char** argc)
 printf("Hello World!\n");

Then compile it with:

tcc hello.c -o hello

Posted by kilmister_2 on Oct. 19 2006,12:19
I will try. Thanx for now
Posted by kilmister_2 on Oct. 20 2006,14:29
I tried and it worked.Thanx clacker
Is tcclib.h the substitute of all other libraries too?

Posted by clacker on Oct. 20 2006,15:42
No, it's fairly limited and the other libraries aren't included.  Things like math.h and the math library are not included.

If you need to compile something more complicated than a really simple program, you might try the gcc1-with-libs.dsl extension.  It includes a lot of the libraries (like libreadline and libncurses, X developement libraries, and gtk1.2 developement libraries), plus make and patch.  There is also a gcc1-with-libs.unc in the testing section that should work on lower memory machines.

Posted by kilmister_2 on Oct. 23 2006,08:24
thank you for the information, clacker.
Posted by ubermai on Dec. 23 2006,09:00
Using the gcc1-with-libs extension in both .dsl and .unc format, I have not been able to compile my first C program. :(

Here's the program:
[File: hello/hello.c]
#include <stdio.h>
int main()
   printf("Hello World\n");
   return (0);

I've tried a bunch of different options at the command line, but I haven't found one that works. Maybe my program has been improperly written?

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.