Then how do I do it just for windows?
Printable View
Don't do that
I'm not sure exactly what you mean by "closing" (you mean the terminal window?)
but good programs finish as soon as they're done, and do not hang for user input unnecessarily
Say you release a program that takes input from stdin does something and outputs to stdout, exiting 0 on success and any other value on error, errors get sent to stderr
I would like to be able to say something like
orCode:slash112_program || echo "Error $?"
hanging the program for input at the end breaks program flowCode:cat some_file | slash112_program | less
anyway....
You can't (well, you can, but it's way more trouble than it's worth)
Either make the various platform & architecture packages yourself
or the easy route - just release the code
If the program's useful, people will package it up for their platform / architecture of choice
It does that for you :)
Go to the folder with your Code::Blocks file, then go to bin/Debug. A .exe file should be in there :)
If you use standard C++, it will compile on any platform with no change in code :D Firefox compiles on every major platform, using the same code, with very little preprocessor.
"C++ will let you shoot your foot without warning you. In fact, it will even load the gun for you."
~ Allegro User
Ynot. I'll give you an example. If the program asks you to input something, you would put it in. You would get an instant response, and then the terminal window would instantly shut the moment after the new text is displayed. This is not what you want.
It's not that I need it at this level, I don't need any fancy way of closing the program at this level. It is just purely for having it there.
There are a lot of things you need system calls for, though, like GUI and scanning directories and such. So Firefox must be using preprocessor directives, or libraries which uses them.
Console programs are normally opened from the terminal, though. And if you do that, then the terminal doesn't close and you'll see the output. It's just if you open it by double clicking on the executable that you won't see the text, but then that's no how the programs are supposed to work. If you want those kinds of programs you need GUI.
Funny thing, I've got C++ as a university subject this year. Of the things we'll learn this year, there was only one thing I haven't done before.
I said little preprocessor. I've looked at the Firefox code because I reverse engineered a chunk of it. All of this stuff uses a NPWindow object, almost all of the preprocessor is in there.
But stick with the terminal while learning, GUIs can be a pain.Quote:
Console programs are normally opened from the terminal, though. And if you do that, then the terminal doesn't close and you'll see the output. It's just if you open it by double clicking on the executable that you won't see the text, but then that's no how the programs are supposed to work. If you want those kinds of programs you need GUI.
But I'm sure that you'll learn better technique and optimization techniques that you currently don't know. :) Assuming the professor is competent, I had a professor in college who was a good C++ programmer in 1995, but he stuck to those techniques, so we were taught no modern designs. C++ coding changes very quickly, if you don't stay on top of it, you can fall behind quickly.Quote:
Funny thing, I've got C++ as a university subject this year. Of the things we'll learn this year, there was only one thing I haven't done before.
I can't wait till I get to GUIs. That will be kick ass.
C++ is a nightmare with GUIs because the language isn't designed for it. I just spent 3 full workdays creating a frame, a dynamic set of menus, a status bar, and a web preferences pane. :(
Luckily, there are graphical ways to do it in 5 minutes, which is what I recommend using when starting out. The only reason I don't use that is because I need more control over them.
Haha, wow.
But still... it would be worth it.
I applied to a computer games course which consists of programming in C++ (I think...) and 3d modelling. I want to get into that (although I applied to physics too, at the time I wanted that more)
But yea... I'm just learning this so I have a bit of knowledge before going there (If I get in)
Ah, okai.
Yeah, I know. I tried learning GUI a while back, but I simply gave up on it for a while. I didn't have a clue about what I was doing, or what the code elements meant or anything. Figured I'd just write a console program with some of the same functionality and port it when I was ready :p
Yeah, I hope so. There must be things I've missed, since I've mostly thought myself what I know. But I think he must be a good programmer, he's taught that specific course for the two year it's run, and he taught the Java course the engineers attended instead. He ought to be good by now.
Good Java Programmer != Good C++ Programmer, very different designs.
Also, almost all of your functionality can be done using the console. I'm currently tearing apart an application so that the functionality is completely disjoint for the main window. The window runs by itself and loads the functionality as a dll.
Yeah, I'm aware of that, but he's an experienced programmer, he's used quite a few different languages, so I'm guessing he'd want to teach the language properly. Also, he started introducing "best practise" rules the second lesson (accurate ones). That's a good sign.
If you have Ubuntu, I'll show you how to create a simple GUI program if you want. I can do it on Windows too, but I like using the wxWidgets library for that, and that's impossible to compile on Windows, I've tried and failed at that many times. I'm not looking forward to the next major release because I'm planning on recompiling it as a dynamic library.
wxWidgets works perfectly fine on Windows Vista... Code::Blocks with wxSmith does a lot of the work, but it's perfectly possible to code everything by hand with a wx Template.
Then you're lucky. wxWidgets is a very complex build, and it requires a lot of external libraries which do not come with the source. It's really annoying to build.
If I'm not mistaken all I had to do was download the source [I think there is a windows version or something...?] and then tell code::blocks where it was and it compiled it for me. Now all I have to do it fire up a template or use wxSmith ^_____
Here's a list of things to learn before tackling GUIs
methods
header / functional files
classes / structs
static vs dynamic methods
overloading methods
overloading operators
scope
pass by reference vs pass by value
polymorphism / inheritance
inline functions
macros
pointers
reference / dereference
casting
opaque pointers
callback functions
static libraries vs dynamic libraries
preprocessor
If you know those, then you know .01% of C++ :)
the other 99.99% is divided evenly between exceptions and trying to understand the Boost libraries.....
And STL :P
Hey Ninja, i dont know too much about programing and that type of stuff so 1 basic and dumb q.
What kind of applications do you most commonly use programming for? What possible uses does it have?
I think Soros was asking me specifically :P
I professionally write a variety of programs that revolve around our custom GUI format. It's basically a GUI engine, coupled with our database that allows us to build very complex gui apps and websites, really fast. I write the backend engine that runs the thing and communicates with the server.
I also write games from time to time if I'm practicing a new technique or something.
I was just wondering. How would you make it so that you just press a key and it would do something. For example:
if spacebar is pressed
cout << "OMG you pressed space!"
How would you code that first line? And would you need to set a variable for it?
Same with any key, like the left arrow key, or whatever. Just something where you press the key without having to hit enter too.