Teen Programmers Unite  
 

 

Return to forum top

Need alot of help with C Compiler, Please Help!

Posted by FatalDragon [send private reply] at May 04, 2002, 06:11:13 PM

I'm very new to programming. Im running Windows XP, and I'v downloaded Borland's Free C/C++ Compiler (The one from the link in "Quik Start Guides"). I opened the package [that I downloaded] and it installed.
My question is how do I use it? I go to the file "bin" and I find the C compiler file, along with several other files, but when I click on the Compiler file, a command line [Guess that's what it is? Its a window that has black background???] appears and then disappears. So how do I get it to work? And hwo do I input my source codes???
ThanX

Posted by metamorphic [send private reply] at May 04, 2002, 06:48:45 PM

ok slow down

First of all, the borland compiler is DOS based meaning it won't (or at least shouldn't) work in XP. I would recommend downloading DEV C++ from www.bloodshed.net . Be sure to get version 4, not 5 beta becasue it won't compile. Secondly if using borlands C++ compiler, you will need to create your source files in a basic text editor such a notepad and then get it to compile them. Another reason to get devc++.

Secondly, if you do not understand what i just said 100% then i would really suggest learning something much easier that c++. Try Visual basic, QBASIC (may not work cuz of XP) Python or some other easy language.

Posted by RedX [send private reply] at May 04, 2002, 06:51:06 PM

The free compiler from Borland is only a compiler/linker etc. It doesn't have an IDE (the texteditor-like thingy).
To use it you'll have to type your code in a ASCII-textedit (like notepad) and save it as a .cpp-file. and then use the compiler to compile it. Or you could look for one of the free IDE's available on the net. (and send the URL here too.)
If you want to use the notepad-methode you should start "msdos-prompt" and use the utils through dos.
But I would advice to get one of the free IDE's unless you like typing commands like "gcc something.o somethingelse.o evenmore.o -o somekindofprogram.exe -Wall -lstdcxx -lalleg"

RedX

Posted by unknown_lamer [send private reply] at May 04, 2002, 06:56:04 PM

Get Emacs21 for Windows :)

Posted by FatalDragon [send private reply] at May 04, 2002, 07:06:05 PM

Ok, ThanX! That did kinda cross my mind that since I didnt see a Bottons for DOS thing on XP, that it might not work, but I didnt now that BCC was DOS based. I tried the LCC too, but got about the same responses as from BCC.
I thought you had to use wordpad, since I didnt see a any kind of text editer with the BCC, but I didnt know how you compiled it...

I got Python, but I dont realy understand how you make a program using an interpreter. I also got Euphoria, but since the PD version doesnt have a compiler, I didnt spend alot of time with it. Ruby was next, but since I ended up with the Linux version it obiously didnt work. And then I got Free Pascal, but I think it was DOS based too... SO now Im looking for C compilers.

But Ill try the Dev C++ compiler, ThanX Again!

Posted by FatalDragon [send private reply] at May 04, 2002, 07:11:29 PM

Well, Im getting the DEV-4 C/C++ compiler, hopefully it'll work...

Posted by FatalDragon [send private reply] at May 04, 2002, 07:15:03 PM

I tried eMacs on Red Hat 7.2, but didnt spend alot of time with it. Mainly because the computer with Red Hat is only 100MHz, and only 32MB. Actuly the main reason I tried Linux was for the GCC, but I couldnt find it on the HDD, but when I tried to open the RPM it said that GCC was already installed. But Like I said, that compuer was WAY to slow anyway...

Posted by FatalDragon [send private reply] at May 04, 2002, 08:27:15 PM

Ok, I got Dev-4 C++ and it seems to work ok, as far as compiling, linking, ect.

I made a basic Hello program, but when I try to execute it, it appears and then disappears, like the DOS command line.

And also when I start a new project, there is already codes on the text place, an I supposed to back space them, or write my codes in with them??? When I compile the codes that are there, they make and empty window, that DOES stay on the screen. Am I supposed to enter my source code somewhere in the defualt code?

One more question, when starting a new source code, what application file to use for basic programs like Hello? Windows Application, Console Application, WinMain()Project, DLL or Empty???

ThanX again!

Posted by metamorphic [send private reply] at May 05, 2002, 05:33:56 AM

to get rid of the coding that is added at the start, select "blank workspace" or something like that. To stop the app closing straight after, include the file <conio.h> (devc++ may have it, im not sure of hand) and then at the end of the app put getch()

Out of interest, do you know any other languages?

Posted by RedX [send private reply] at May 05, 2002, 06:36:13 AM

Coding for Windows is a bit differend from codeing for dos. When you write something like the "hello world" program using main() you ar writting a console-program, this is like the old dos-programs except that it runs under windows.
For real windows-application you'll have to do a lot more. That's all the code that's already there when you open a new project. There are many tutorial written on this that explain it in depth.

RedX

Posted by FatalDragon [send private reply] at May 05, 2002, 09:00:29 AM

Thanx! Im using "C For Dummines" and it's talking about DOS based apps I think, but I'll try those codes.

Posted by FatalDragon [send private reply] at May 05, 2002, 09:01:51 AM

Wheres the "Blank Workspace" option at? Is it the same as "Empty Project"?

Posted by metamorphic [send private reply] at May 05, 2002, 10:02:23 AM

well if your trying to learn C before C++, I would STRONGLY recommend you stop now before you do yourself any dammage. Learn C++, then you will be able to use C anyway, but also know C++. However, if this is your first language I would recommend starting with something easier.

And yes blank workspace = empty project

Posted by taubz [send private reply] at May 05, 2002, 10:40:22 AM

I disagree. Good programming style is obscured by the nifty semantics of C++. Learning C is not in vein, it makes learning every other programming language easier (including non-object-oriented).

- taubz

Posted by metamorphic [send private reply] at May 05, 2002, 01:31:16 PM

well, C++ is all about encapsulisation and re-use, both being extreamly good programming practices.

Posted by gian [send private reply] at May 05, 2002, 05:59:55 PM

Oh, and by the way, I'm yet to have a DOS app not run in XP. All that has changed is the way in which it runs.

Posted by FatalDragon [send private reply] at May 05, 2002, 08:38:05 PM

Well, I tried putting <conio.h> for the first line, and getch() on the last line, but that didnt work... Still had errors...

But, no, I dont know any other languages... I do have Python 2.2.1, and Euphoria 2.3 (PDv). Im kinda thinking now that maybe it would be best if I learn Python or Euphoria first, that way Ill better understand the various programming concepts.

Is there any way you can make .EXE programs with Python or Euphoria?
ThanX!



Posted by gian [send private reply] at May 06, 2002, 03:22:57 AM

Try a test prog like:

#include <conio.h>

int main( void )
{
   cout << "Testing!";
   return 0;
}


If that still gives you errors, then list the specific ones.
Posted by ra_apollo [send private reply] at May 06, 2002, 05:41:02 AM

as for a good c++ book - "C++ Primer Plus" by stephen prata
is a good buy though i have only seen one edition for c++
ver2.0 there must be one for higher vers also anyway it is the best book to build up basics.

i myself am on the lookout for a good DOS based c++ compiler. i use win95 on 16MB and 166mhz MMX , but hey my machine is still fast!

Posted by metamorphic [send private reply] at May 06, 2002, 05:55:04 AM

apollo, take a look at DJGPP, its a good free DOS compiler with an IDE front end called Rhide or you can have another IDE with it called Emacs, plus a debugger also.

http://www.delorie.com/djgpp/

Posted by unknown_lamer [send private reply] at May 06, 2002, 08:11:59 AM

"I tried eMacs on Red Hat 7.2"

AGHSDFSKJLDFASKLFJAL;SDFJKL;AFJKL;AJFDKL;ASJFL:!!!!!!!!!!!!!!!!!!!!
WHAT! THE E IS NOT LOWERCASE! THE EMACS MEANS EDITOR OF MACROS!
IT IS NOT SOME STUPID DOT-COM CREATION! EMACS PREDATES THE FUCKING WEB BY A LONG TIME! GRSARGH!

END RANT (sorry about that)

As for a C compiler, try getting cygwin from http://www.cygwin.com. It is free and provides a fairly complete POSIX emulation layer for Windows (you can run X with it, so it has to be good).

Posted by CViper [send private reply] at May 06, 2002, 10:28:18 AM

hmm. gian's example should give you some errors, since cout is defined in <iostream> (and thus has nothing to do with <conio.h>) :O

i also remember that i had problems with getch() for a while (some time ago i wrote a console app)... dont know exactly what i did about it, but just try fflush( stdin ); right before getch() (that clears the buffer, so any pending input gets flushed)
You'll need to #include <stdio.h> for it though

Posted by FatalDragon [send private reply] at May 06, 2002, 12:25:05 PM

Ok, like I said, I hadnt used EMACs very much...

I tried the codes @gian said, and it did still have 3 errors, it said:" `count' undeclared (first use in this function)
(Each undeclared identifier is reported only once for each function it appears in.) "

Posted by metamorphic [send private reply] at May 06, 2002, 01:23:08 PM

gians program should be:

#include <iostream>

int main(void)
{
    using std::cout;
    cout << "Testing!";
    return 0;
}


unless i've make a boo boo also
Posted by FatalDragon [send private reply] at May 06, 2002, 04:08:08 PM

Is that for C or C++? I tried it, but it still had errors.
I think Ill stick with Python for now, but thanks for the help! How do you compile Python files?

Posted by metamorphic [send private reply] at May 06, 2002, 04:55:42 PM

I thought python was just an interpreted language?

Posted by FatalDragon [send private reply] at May 06, 2002, 09:09:27 PM

I did too, but some of the files that came with Python 2.2 said "Compiled Python File"???

Posted by unknown_lamer [send private reply] at May 07, 2002, 08:11:48 AM

Python is bytecompiled, which is like half-compiling. Basically Python has a compiler that targets a non-existant machine (the Python VM, and I think it will work with Parrot once Perl 6 is out). This non-existant machine is then implemented as a small emulator-ish program that loads the bytecode and interprets it. This is faster than interpretation because you spend less time parsing the code, you can perform optimizations, etc. Bytecompiled code is slower than machine code, but it isn't that much slower and the code is portable between any machine that has an implementation of the VM.

Posted by ComoVaca [send private reply] at May 17, 2002, 10:26:43 PM

I think I'm going learn Basic before anything... just to skip all of this confusion... Nah, not really, I don't know any languages, I have just been messin with html... I am taking C++ next year in school, should I start learning by myslf over the summer?

Posted by gian [send private reply] at May 18, 2002, 06:29:17 AM

Sorry... my bad... mustn't have been completely on the ball that day :-)

Posted by AnyoneEB [send private reply] at May 18, 2002, 10:27:03 AM

Just to let you know QBasic runs fine on WinXP.

Posted by unknown_lamer [send private reply] at May 18, 2002, 02:01:29 PM

Learning BASIC makes learning modern programming more difficult...

Posted by AnyoneEB [send private reply] at May 18, 2002, 05:55:54 PM

I learned BASIC first, but there is definitely a valid arguement to not doing so. Mostly that BASIC isn't anything like C/C++ and other alike languages.

Posted by RedX [send private reply] at May 18, 2002, 06:19:51 PM

I even doubt qbasic *is* a language. I think it was an act of sabotage by the Anti-software-alliance (a bit like releasing nerve gas only more effective).

RedX

Posted by gian [send private reply] at May 18, 2002, 07:54:37 PM

Don't forget though, that BASIC is a nice introduction to the concept of explicitly defining each action you want the computer to take in a specific order.

Posted by AngelOD [send private reply] at May 18, 2002, 07:58:03 PM

Hmm, well I started out with learning BASIC as well, and I found learning other languages was a bit easier (though my formatting wasn't all that good in the beginning, I admit).

Anyway, I was just thinking for a bit, having downloaded Emacs21 for Windows, how lame that program seems at first.. I mean, first of all, it sounds like IMac which wasn't really a serious system (I like *some* Macs, but *not* the IMac).. And second, it has no interface of any sorts, being generally user-unfriendly.

I'm not saying it should have all sorts of useless stuff, just that after looking at it for half an hour, I still hadn't gotten any further than to open a textfile, and I can easily use other programs for *that* sorta thing.

Posted by unknown_lamer [send private reply] at May 18, 2002, 08:21:29 PM

if you use iostream, make sure to use std::cout not cout...

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.