Stop Microsoft

Operating Systems => Linux and UNIX => Topic started by: Agent007 on 16 January 2003, 21:26

Title: Turbo C
Post by: Agent007 on 16 January 2003, 21:26
Hi

I use Turbo C in Windows to compile some simple C programs....When there is an error, they show up in the window below the code. Is there something similar for Linux?

thanks,


007
Title: Turbo C
Post by: shuiend on 17 January 2003, 00:49
i personly use Kedit for editing the cpp files and using g++ to compile them. you can uise g++ like this
g++ -o whatyouwantprogramtobecalled filename.cpp
This is probally not the best way to do it but it works for my needs. I just have kedit open and edit away then i save then compile. It tells me what errors i get then i go into kedit and edit where it says there errors are then resave and try again
Title: Turbo C
Post by: Agent007 on 17 January 2003, 21:23
Hi,

I have compiled the following c program, but when it is executed via the terminal, the printf statement dosen't show up...what cud be wrong?

thanks,
007

 
quote:

#include <stdio.h>
main ()
{
printf("Hello");
}

Title: Turbo C
Post by: voidmain on 18 January 2003, 01:17
Try:

printf("Hello\n");
Title: Turbo C
Post by: Siplus on 18 January 2003, 01:27
basic c/c++ question:
why does c++ have 2 print commands?
printf from stdio, and cout from iostream?
Title: Turbo C
Post by: flap on 18 January 2003, 01:46
Well basically because C++ features cout as part of its ostream class, but the stdio library is still available as well.
Title: Turbo C
Post by: jtpenrod on 18 January 2003, 01:55
quote:
basic c/c++ question:
why does c++ have 2 print commands?
printf from stdio, and cout from iostream?
The reason for that is really quite simple: C++ is basically a superset of C, and as such, includes everything available in C itself. C++ commands such as: cout and cin are C++ objects that encapsulate the same operations that printf does.
_____________________________________
Live Free or Die: Linux
(http://www.otakupc.com/etsig/dolphin.gif)
Their fundamental design flaws are completely concealed by their superficial design flaws.
Title: Turbo C
Post by: jtpenrod on 18 January 2003, 02:05
Code: [Select]
First off, the syntax is incorrect. Try this instead:
Code: [Select]
Secondly, there's a problem with running a console app in Winderz that you don't have with Linux. You need to cause the program to pause and busy-wait before it exits. That's why you add "getchar" so the program will wait for a character from the keyboard. Otherwise, the program outputs the "Hello" and exits so fast you'll never see it.

Just another wonderful Winderz "feature"     (http://tongue.gif)    
____________________________________
Live Free or Die: Linux
(http://www.otakupc.com/etsig/dolphin.gif)
Their fundamental design flaws are completely concealed by their superficial design flaws.

[ January 17, 2003: Message edited by: jtpenrod ]

Title: Turbo C
Post by: voidmain on 18 January 2003, 02:23
My experience on the old days was all you had to do was add a "\n" to actually make it flush the IO with a CR. Will this not work today?
Title: Turbo C
Post by: flap on 18 January 2003, 02:34
It should work without that.