newb needs c++ help
by John D · in Technical Issues · 03/15/2003 (6:19 am) · 5 replies
hey guys, after messing around with torque and scripting for a while and i figured i'd get involved with c++ again after some time to not only know the language to begin with but to get a better understanding of scripting torque.
now i thought i posted this issue last night before i went off to go start drinking... but i can't seem to find it so here goes again.
i decided to dig through some bruce eckel books which were recommended to me and to use "teach yourself c++ in 21 days" as well but when i try the examples in the book i couldn't get them to compile in borland or VC++.
at first i typed these up in them by setting up a new file or default workspace and i would get errors (maybe cause they were being used in some template) but the only way i got it to work was to type them up in notepad and then to open them up and compile them. problem then is that in borland the .exe is produced but after clicking on it a dos window pops up and vanishes. in VC++ i got it to work after running it inside the prog, and if i use the dos prompt to find the folder its in and execute it it'll work (this a typical "hello world" setup)
the help that i need....
how do i configure borland and VC++ to work with simple projects/examples that i find and how do i setup the dos window so that when i click on the .exe it stays up?
besides all this i could really use some tips and pointers on what to watch out for and if you know of any material or refrences for me to look up let me know, now i was really profiecent at pascal during my middle and high school days and now i'm working on getting a physics degree here. so just hit me with whatever you've got and who knows, if i get really good i plan on putting the two together and making some really nice contributions to the TGE community.
thanks for the help all
now i thought i posted this issue last night before i went off to go start drinking... but i can't seem to find it so here goes again.
i decided to dig through some bruce eckel books which were recommended to me and to use "teach yourself c++ in 21 days" as well but when i try the examples in the book i couldn't get them to compile in borland or VC++.
at first i typed these up in them by setting up a new file or default workspace and i would get errors (maybe cause they were being used in some template) but the only way i got it to work was to type them up in notepad and then to open them up and compile them. problem then is that in borland the .exe is produced but after clicking on it a dos window pops up and vanishes. in VC++ i got it to work after running it inside the prog, and if i use the dos prompt to find the folder its in and execute it it'll work (this a typical "hello world" setup)
the help that i need....
how do i configure borland and VC++ to work with simple projects/examples that i find and how do i setup the dos window so that when i click on the .exe it stays up?
besides all this i could really use some tips and pointers on what to watch out for and if you know of any material or refrences for me to look up let me know, now i was really profiecent at pascal during my middle and high school days and now i'm working on getting a physics degree here. so just hit me with whatever you've got and who knows, if i get really good i plan on putting the two together and making some really nice contributions to the TGE community.
thanks for the help all
About the author
#2
A build tool for Java called ANT has prompted lots of C/C++ imitators, and one of my side projects for my game is setting up Torque to build with one of these environments that way, Linux, Mac and Windows builds can all be done the exact same way . . .
also you need to specify which Visual Studio version you are using they vary greatly in configuration problems.
03/15/2003 (4:15 pm)
this is one of the major "problems" or stumbling blocks with C/C++ the arcane configuration hoops that you have to jump thru to just get something to compile. The setup and config of the environment is a bigger pia than the actual coding in most cases.A build tool for Java called ANT has prompted lots of C/C++ imitators, and one of my side projects for my game is setting up Torque to build with one of these environments that way, Linux, Mac and Windows builds can all be done the exact same way . . .
also you need to specify which Visual Studio version you are using they vary greatly in configuration problems.
#3
If you have it print:
'Hello World'
The program life is very short. To go around this, open a MS-DOS window (go to run and type in cmd, press enter)
Then using DOS commands such as cd, dir, etc, navigate to the proper directory where the .exe is located, and execute it. Now your dos window will stay open.
03/15/2003 (4:36 pm)
The dos window will open when the program initilizes, and close when the program ends.If you have it print:
'Hello World'
The program life is very short. To go around this, open a MS-DOS window (go to run and type in cmd, press enter)
Then using DOS commands such as cd, dir, etc, navigate to the proper directory where the .exe is located, and execute it. Now your dos window will stay open.
#4
(BTW, it's a minor thing, but under NT, 2000, and XP, the command console has nothing to do with the MS-DOS box of earlier versions of windows--technically, it is an NT command processor console.)
03/17/2003 (9:24 pm)
John: When debugging console applications, sometimes a simple breakpoint placed on the return statement at the end of your main() is all you need to keep it open long enough to verify the output. Another helpful trick is to place a shortcut to cmd on your desktop or on your taskbar--then play around with the properties for the shortcut to have it open in your desired working directory. Play around with those properties, and also the settings under the console's system menu, and pretty soon you will have it set up nicely. One of the first things you'll probably want to do is increase the buffer size and the number of lines displayed for all console windows.(BTW, it's a minor thing, but under NT, 2000, and XP, the command console has nothing to do with the MS-DOS box of earlier versions of windows--technically, it is an NT command processor console.)
#5
At first i thought it didn't compile right when it was just going through the code real fast. i found that you could use getche(); to get it to wait for a return press or system("PAUSE");? i think. and cin.get(); i didn't try system(pause) out but i think it tells the prog to wait for a any key press?
i read long ago that the dos prompt found under Xp's accessories isn't the real one and i'm gonna look around on how to configure it to suit my needs but i was also wondering since its not a true dos prompt will this affect anything? or atleast anything related to torque operation?
03/18/2003 (3:08 pm)
Thanks guys for the help, i found a few ways to solve my problem.At first i thought it didn't compile right when it was just going through the code real fast. i found that you could use getche(); to get it to wait for a return press or system("PAUSE");? i think. and cin.get(); i didn't try system(pause) out but i think it tells the prog to wait for a any key press?
i read long ago that the dos prompt found under Xp's accessories isn't the real one and i'm gonna look around on how to configure it to suit my needs but i was also wondering since its not a true dos prompt will this affect anything? or atleast anything related to torque operation?
Torque Owner Chris Traill