Questions tagged [tcc]

TCC is a tiny C compiler which enables you to use C as scripting language.

117 questions
10
votes
2 answers

strange behavior when trying to compile a source with tcc against gcc generated .o file

I am trying to compile a source with tcc (ver 0.9.26) against a gcc-generated .o file, but it has strange behavior. The gcc (ver 5.3.0)is from MinGW 64 bit. More specifically, I have the following two files (te1.c te2.c). I did the following…
packetie
  • 4,839
  • 8
  • 37
  • 72
9
votes
3 answers

Problems compiling TCC on OS X

Has anyone successfully compiled TCC on OS X? From what I know it should be possible but when I run make I get the following error: $ make gcc -o tcc tcc.c -DTCC_TARGET_I386 -O2 -g -Wall -fno-strict-aliasing -mpreferred-stack- …
Aaron Gough
  • 93
  • 1
  • 3
9
votes
3 answers

pow() cast to integer, unexpected result

I have some problems using an integer cast for the pow() function in the C programming language. The compiler I'm using is the Tiny C Compiler (tcc version 0.9.24) for the Windows platform. When executing the following code, it outputs the…
Jori
  • 1,122
  • 2
  • 18
  • 36
8
votes
1 answer

Recognizing clang, gcc, and tcc by implementation-defined macros

I use clang, gcc, and tcc, and I'd like to be able to differentiate between the three in a common header. Judging by their macro dumps, I expect that the presence of the __clang__ macro will uniquely identify clang. I'm unable to get a macro dump…
Petr Skocik
  • 58,047
  • 6
  • 95
  • 142
7
votes
2 answers

Tiny C Compiler's generated code emits extra (unnecessary?) NOPs and JMPs

Can someone explain why this code: #include int main() { return 0; } when compiled with tcc using tcc code.c produces this asm: 00401000 |. 55 PUSH EBP 00401001 |. 89E5 MOV EBP,ESP 00401003 |. 81EC…
alexstx
  • 91
  • 6
7
votes
2 answers

How fix Error of error of crt1.o,crti.o in Build TinyCCompiler(TCC) from Source?

How fix Error of crt1.o,crti.o in Build TinyCCompiler(TCC) from Source? https://github.com/LuaDist/tcc i'm test this at my Desktop system(ubuntu) and also test on server(centos). at both OS , show error. Error : tcc: file '/usr/lib/crt1.o' not…
C-Compiler
  • 71
  • 5
6
votes
3 answers

Tiny C Compiler (TCC) and winsock?

Can I use a socket library from TCC? I can't find any reference to winsock or sys/socket.h in the include directory. If i remember correctly, winsock was part of the windows platform SDK (?) If so can I link that with TCC?
user181351
6
votes
4 answers

How to insist a C compiler put local variables on the stack, not in registers

I am trying to port an historical functional language interpreter (KRC for EMAS) to modern systems (C for Unix) and it has a garbage collector that expects to be able to scan the stack for pointers into the heap to know which pointers it must…
martinwguy
  • 948
  • 6
  • 14
4
votes
1 answer

IOCCC 1988/isaak.c - why no output even after ANSIfication?

The carefully crafted, self-including code in this IOCCC winning entry from 1988: http://www.ioccc.org/years.html#1988_isaak ...was still too much for certain systems back then. Also, ANSI C was finally emerging as a stable alternative to the…
4
votes
2 answers

C linking error (with tcc)

I'm trying to run the example from tiny cc (tcc-0.9.26-win64-bin.zip) called libtcc_test.c. I've copied libtcc.h from libtcc into include and libtcc.def into lib. Then I ran tcc ./examples/libtcc_test.c and got a linking error :/ tcc: error:…
Maciej Kozieja
  • 1,812
  • 1
  • 13
  • 32
4
votes
2 answers

Compatibility of compiled gcc and tcc structs

I'm trying to run libtcc from C++ to use C as a runtime scripting language. The runtime compiled code has to be able to run functions from the outside code. This is working fine when passing ints, but when passing a struct from the tcc-code to the…
phiresky
  • 406
  • 4
  • 15
3
votes
1 answer

How to automatically link symbols using TinyCC?

Using TinyCC in my C program lets me use C as a sort of scripting language, reload C files on the fly, and do a lot of fairly neat things... But, one thing is really bothering me. Linking. I do my normal tcc_new, and tcc_set_output_type with…
3
votes
1 answer

C code compiles and runs under Tiny C Compiler, but it does not run under GCC

I'm relearning C. The following code segment compiles and runs as expected under Tiny C Compiler (TCC). It compiles without complaint under GCC, but it doesn't produce any output under Windows 10. When compiled and ran under Ubuntu, Tiny C Compiler…
Chief Cook
  • 61
  • 5
3
votes
3 answers

Resolve TCC warnings on macOS

I'm looking for a C interpreter to use while making a simple C utility to avoid compiling all the time. I installed TCC as suggested here but I get warnings and errors. How do I run TCC correctly? $ tcc -run hello.c .../usr/include/sys/cdefs.h:81:…
forthrin
  • 2,709
  • 3
  • 28
  • 50
3
votes
1 answer

Basic C SDL2 program won't work with TCC while it does work with GCC (Linux)

I have the following C code (for clarity, I know it's not complete code and it should handle events and stuff like that): #!/usr/bin/tcc -run -L/usr/lib/x86_64-linux-gnu -D_REENTRANT -DSDL_MAIN_HANDLED -I/usr/include/SDL2 -lSDL2 -lGL…
scippie
  • 2,011
  • 1
  • 26
  • 42
1
2 3 4 5 6 7 8