|
I hope this hasn't been asked already, I looked for a little on google and the beginning of this thread but didn't find anything. I was wondering how to turn a C++ file into an actual application. Everything I do now just compiles into an a.out and i can run that through the command line but I was hoping I could actually make something that I could double click and open a little window. It wouldn't even have to look fancy, just a blank white window would be awesome. PS. I'm using a Mac with Xcode and TextMate but I also have a windows machine at the ready. So suggestions for either would be awesome.
|
# ? Mar 24, 2008 22:25 |
|
|
# ? Apr 29, 2024 02:49 |
|
"a.out" is an actual application. It's the default name in gcc for an executable if you don't specify one. By "double click and open a little window", are you referring to a terminal (command line) window, or an actual GUI window? In the case of the former, what you have should already work. In the latter, you'll need to start learning a GUI API (no easy feat). Which API you pick depends on which platform(s) you want to develop for. EDIT: the OP now has a list of GUI libraries, shamelessly stolen from Professor Science's reply on the first page. Avenging Dentist fucked around with this message at 22:52 on Mar 24, 2008 |
# ? Mar 24, 2008 22:46 |
|
drat, I was hoping there would be something a little easier than learning an API but oh well. I was going to use it cross platform because my main computer is a Mac and all of my friends run windows. I wanted to make an 'application' so that I could make a little program just messing around and send it to them to use/make jokes about/help me improve my programming, stuff like that. Well, I'll just start checking out some of these sites. Thanks.
|
# ? Mar 24, 2008 23:25 |
|
BraggPxnk posted:drat, I was hoping there would be something a little easier than learning an API but oh well.
|
# ? Mar 25, 2008 00:10 |
|
Incoherence posted:The easiest way to do what you're describing is to switch to Java. This is true, actually, and something I hadn't thought of when I was trying to come up with a reply. Java's UI may be butt-ugly, but you'll only have to code it once no matter which platform you plan to run it on. Since it sounds like you're just playing around with programming basics with your friends, Java might be ideal. Plus, Java and C++ are similar enough that you can more or less transfer what you learn from one to the other freely, at least for the basic stuff.
|
# ? Mar 25, 2008 02:00 |
|
As long as you're using a cross-platform API, the amount of rewriting you need to do should be minimal. wxWidgets, for instance, uses native controls and supports a wide variety of operating systems.
|
# ? Mar 25, 2008 02:09 |
|
Avenging Dentist posted:As long as you're using a cross-platform API, the amount of rewriting you need to do should be minimal. wxWidgets, for instance, uses native controls and supports a wide variety of operating systems. The first one I looked at was wxWidgets is the first one that I looked at and downloaded. It looks pretty good, I'm just not sure exactly what to do with it. I unziped the file and just kinda looked at the 'install' docs. I'll have to browse their website (and google) later and try to figure exactly what to do. I have heard a lot about how Java is a lot like C++ and I always considered learning it. But I don't really feel like tackling another language right now. I found a free online course on Ruby and I'm just kinda palin' around with that seeing if I want to try and get good at it.
|
# ? Mar 25, 2008 03:42 |
|
BraggPxnk posted:I have heard a lot about how Java is a lot like C++ and I always considered learning it. They have a lot of syntactical similarities, and to a total beginner, they're pretty similar, but when you start getting into more advanced things, they can be very different, especially in terms of design philosophy.
|
# ? Mar 25, 2008 03:52 |
|
Avenging Dentist posted:They have a lot of syntactical similarities, and to a total beginner, they're pretty similar, but when you start getting into more advanced things, they can be very different, especially in terms of design philosophy. Well...I've taken four classes on C++ already. That was about a year ago, and since then I have just been goofing off with it in my spare time. I wouldn't necessarily say that I have moved onto 'more advanced things' but I'd say that I am no longer a beginner.
|
# ? Mar 25, 2008 03:58 |
|
BraggPxnk posted:drat, I was hoping there would be something a little easier than learning an API but oh well. I'm a big fan of Python + Qt, although if one of the goals of this is to improve your C++ programming skills, just plain C++ and Qt would be more appropriate.
|
# ? Mar 25, 2008 06:19 |
|
JoeNotCharles posted:I'm a big fan of Python + Qt, although if one of the goals of this is to improve your C++ programming skills, just plain C++ and Qt would be more appropriate. I'm going to also suggest using Qt with C++.
|
# ? Mar 25, 2008 11:28 |
|
I'm trying to do the following:code:
|
# ? Mar 25, 2008 16:31 |
|
CasualCliffy posted:but according to the standard, you cannot declare a template parameter to be a friend. I don't see anything in the standard that says this, except that default template parameters can't be used in friend template declarations.
|
# ? Mar 25, 2008 17:05 |
|
CasualCliffy posted:I'm trying to do the following: If you really want this, put the implementation of your class into a private base, then, from inside Foo, pass off that base to T so that it may access the implementation.
|
# ? Mar 25, 2008 17:11 |
|
coods posted:I'm going to also suggest using Qt with C++. I've been compiling Qt all day
|
# ? Mar 25, 2008 20:05 |
|
That Turkey Story posted:If you really want this, put the implementation of your class into a private base, then, from inside Foo, pass off that base to T so that it may access the implementation. It looks like Comeau will let you do something like what he wanted with C++0x extensions on. Did the standard change in this regard?
|
# ? Mar 25, 2008 20:08 |
|
I've been asking questions in this thread about this code I'm writing to help me learn to be a better C++ programmer for a while, here's what I've come up with thus far: trie.h main.cpp QUnit.h Edit: moved code from codepad.org to permanent hosting So who wants to tell me how absolutely terrible my design/style/code is? Lexical Unit fucked around with this message at 01:17 on Mar 26, 2008 |
# ? Mar 25, 2008 21:12 |
|
BraggPxnk posted:I've been compiling Qt all day Ok, now I'm starting to get worried. I started compiling Qt at around 10 this morning and its still running at 7:30pm. Is this normal?
|
# ? Mar 26, 2008 00:27 |
|
Lexical Unit posted:I've been asking questions in this thread about this code I'm writing to help me learn to be a better C++ programmer for a while, here's what I've come up with thus far: code:
|
# ? Mar 26, 2008 00:49 |
|
Ah good point, that hadn't crossed my mind. Originally I had just the lexical_cast version but then I thought, "shouldn't I be nice and support compiling when boost isn't installed?" and that prompted me to do what I did there. I'm not sure how I'd make the stringstream version throw the same exceptions in the same cases without basically re-writing boost::lexical_cast though. Do you think it would be better to just leave out all the conditional compiling and just flatly require boost?
|
# ? Mar 26, 2008 01:00 |
|
BraggPxnk posted:Ok, now I'm starting to get worried. I started compiling Qt at around 10 this morning and its still running at 7:30pm. Is this normal? Is it actually doing anything? Check the command-line output, doing one action shouldn't take more than a minute so make sure lines are scrolling. According to a quick google, 2 hours on a Pentium 2 is considered "slower than normal," and others are reporting ~10 minute compile times.
|
# ? Mar 26, 2008 01:06 |
|
Lexical Unit posted:Do you think it would be better to just leave out all the conditional compiling and just flatly require boost? Just require Boost. Speaking of, have you been following the Trie discussion on the Boost developers list?
|
# ? Mar 26, 2008 01:09 |
|
ColdPie posted:Is it actually doing anything? Check the command-line output, doing one action shouldn't take more than a minute so make sure lines are scrolling. According to a quick google, 2 hours on a Pentium 2 is considered "slower than normal," and others are reporting ~10 minute compile times. It is actually been doing something. I've been checking the output a lot and it keeps on doing its think. I did the './configure' and the 'make'. It's doing the makefiles now. I'm using a 1Ghz G4 Mac running leopard.
|
# ? Mar 26, 2008 01:12 |
|
Avenging Dentist posted:Speaking of, have you been following the Trie discussion on the Boost developers list?
|
# ? Mar 26, 2008 01:21 |
|
Be warned, you'll be inundated with mail unless you check your mail everyday. The Boost developer's list is incredibly busy. I should set up some more filters for it.
|
# ? Mar 26, 2008 05:18 |
|
Well, I'm already subscribed to the gcc, gcc-help, xorg, TAO, libstdc++, festival-talk, and boost-users lists, so a little more won't hurt. It gives me something to do during work down-time. Interesting that they're modeling it after std::map, I went with std::set instead. However I can certainly see why one modeled on map would be quite useful.
|
# ? Mar 26, 2008 16:09 |
|
I came across this a year or two ago:rob pike posted:Simple rule: include files should never include include files. If instead they state (in comments or implicitly) what files they need to have included first, the problem of deciding which files to include is pushed to the user (programmer) but in a way that's easy to handle and that, by construction, avoids multiple inclusions. Multiple inclusions are a bane of systems programming. It's not rare to have files included five or more times to compile a single C source file. The Unix /usr/include/sys stuff is terrible this way. It made sense at the time and I've followed this rule ever since (it's Rob Pike for Christ's sake). But when it comes to libraries it starts to get overly tedious for people using your library. You don't want to have a monolithic header file (think of the sockets library only used one header) but you also don't want them to have to read comments in your headers to find dependencies. What do other people do? And yes, I do employ #ifdef guards on the header files as well.
|
# ? Mar 26, 2008 22:20 |
|
I disagree. The author should determine dependencies and set them in stone once; the users should be able to bypass those just as they're bypassing whatever issues and complexities prompted them to use pre-existing code to address in the first place. vvvvvvvv Uninitialized pointers? haveblue fucked around with this message at 22:37 on Mar 26, 2008 |
# ? Mar 26, 2008 22:30 |
|
I've got a programming bug that's about to make me start pulling out my hair: I'm writing a plugin in C++ for both the 32-bit and 64-bit Windows versions of Maya. When I compile and test the plugin in a 32-bit environment, it works great. In 64-bit Maya, it causes the whole program to crash, and I have no idea why. It's exactly the same code, and none of it *should* be sensitive to a platform change like that. Furthermore, when trying to poke around or removing bits and pieces of my code to see if I can figure out what part is causing the crash, I start finding out that re-arranging trivial lines of code, or worse yet, changing the names of local variables can either cause the crash to happen at different places or not at all. Results are totally inconsistent. It makes no sense! I loving hate errors like this. Does anyone know what the hell could cause a completely inconsistent crash like this?
|
# ? Mar 26, 2008 22:37 |
|
Plastic Jesus posted:I came across this a year or two ago: That is possibly the stupidest thing I've read this year. Are you sure he wasn't trolling?
|
# ? Mar 26, 2008 23:56 |
|
GuyGizmo posted:I've got a programming bug that's about to make me start pulling out my hair: Unfortunately, plenty of things could be wrong: invalid assumptions about the size of ints/pointers, different alignment on structs or other memory, API calls that work slightly differently (in both windows AND maya)... the list goes on. If you have a debugger and stack dumps though, it shouldn't be too significant a problem to track down the actual culprit.
|
# ? Mar 27, 2008 00:05 |
|
Plastic Jesus posted:I came across this a year or two ago: Avenging Dentist posted:Are you sure he wasn't trolling?
|
# ? Mar 27, 2008 00:22 |
|
Plastic Jesus posted:I came across this a year or two ago: His only argument is that multiple inclusions slow down the compiler. My response would be: Yes? And?
|
# ? Mar 27, 2008 00:25 |
|
Plastic Jesus posted:I came across this a year or two ago: Apparently, you don't know enough to check the dates on what you read on the internet as that was written in 1989. The line: quote:The result is often thousands of needless lines of code passing through the lexical analyzer, which is (in good compilers) the most expensive phase. should have also raised a red flag as compilers these days skip files they see are entirely protected by an if guard.
|
# ? Mar 27, 2008 00:27 |
|
Presto posted:His only argument is that multiple inclusions slow down the compiler. My response would be: Yes? And? And compile time is a major bottleneck for large C/C++ programs. Pike's advice might be outdated, but including (non-system) headers willy-nilly is a good way to kill compile performance.
|
# ? Mar 27, 2008 00:43 |
|
Plastic Jesus posted:I came across this a year or two ago: This sounds sane to me, and it's something I always wondered about. But I never follow that rule for the following reason: how do you include types that are defined in other headers, in your header? code:
code:
Edit: #ifdefs truncated, but pretend they're there
|
# ? Mar 27, 2008 00:58 |
|
ColdPie posted:This sounds sane to me, and it's something I always wondered about. But I never follow that rule for the following reason: how do you include types that are defined in other headers, in your header? It can't. The compiler MUST know the size of One in order to compile Two. It can be done with a level of indirection, though: code:
|
# ? Mar 27, 2008 01:06 |
|
Freshman CS major. I am doing a very, very basic program to represent trees. What it does is the computer says a number from 1 to 20 and depending on the number given (the first number it will always say is "10"). The user enters if that is correct, lower, or higher. It's simple enough but I am getting a really loving annoying syntax error that is not letting progress further.code:
|
# ? Mar 27, 2008 01:13 |
|
notMordecai posted:Freshman CS major. I am doing a very, very basic program to represent trees. What it does is the computer says a number from 1 to 20 and depending on the number given (the first number it will always say is "10"). The user enters if that is correct, lower, or higher. It's simple enough but I am getting a really loving annoying syntax error that is not letting progress further. If that's your entire file, then you're just dumping executable code in no-man's land. It needs to be in an execution path, like your main function for instance.
|
# ? Mar 27, 2008 01:17 |
|
|
# ? Apr 29, 2024 02:49 |
|
Drx Capio posted:It can't. The compiler MUST know the size of One in order to compile Two. It can be done with a level of indirection, though: It's dumb, but what it was suggesting was: code:
|
# ? Mar 27, 2008 01:23 |