ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Well, I agree it's not helpful, but this thread really takes on a satirical component And, repeating the same hints over and over (like: "look, what exactly your function DOES") probably won't help either ... until the OP finally accepts the fact he has FUNDAMENTAL misconceptions and starts reading a book, maybe returning with some specific questions, making some sense
Kenny, we have seen this, or variations of this, code before. I am going to make one very strong recommendation. Please describe in English what you would like this code to achieve. Please don't post any more code until you have done that because it really isn't possible to help you properly until you are able to state exactly in a non-programming way what you are trying to achieve.
Uhm -- lol. "Some reason" could be that your code does a handful of computations, only to throw the results completely away. Really, learn some structured/imperative programming first, start with "hello world¨...
This post doesn't show me any evidence whatsoever of your personal ability to program. Start with "hello world".
Last edited by pr_deltoid; 07-03-2010 at 01:59 AM.
Note the GTK-specific guint16 and guint32 declarations and the use of the 'pixel' declaration. Now GTK-related files are included for a purpose. And the computations are formulas taken from Wikipedia for alpha blending.
But the code is still senseless - it just burns CPU cycles not changing anything in the calling scope. You can change only one senseless thing at a time ?
Still, in the big scheme of things the now resolved issue of previously in vain included header files is a smaller issue. The big issue is that you still completely miss the very fundamentals of procedural programming regarding return values.
And because of these fundamental issues your C++ code in another thread is as senseless as this one.
The fact that you take formulae from Wikipedia does not necessarily make you code sensible - it's not the formulae you have problems with, it the programming concepts.
Last edited by Sergei Steshenko; 07-03-2010 at 02:57 AM.
Right, hints are good and were totally appropriate in this post, because the OP seems to be missing some fundamental programming concepts.
@Kenny_Strawn: you should generally not be offended if someone tells you that you need a bit better understanding of some fundamentals. That should just help you to avoid such errors in the future.
BUT, I totally agree with Kenny_Strawn, that there are different ways to tell someone to dig further into the details. And just laughing at someone is definitely NOT the correct way. I think MOST of us were beginners at some time ;-)
I and others have already suggested he start with the basics (eg: http://www.linuxquestions.org/questi...ml#post4021155) because lots of the code he posts just has too much wrong with it to bother picking it all apart. Otherwise I may as well start transcribing parts of my programming books onto this forum because the authors have already dealt with the dozens of mistakes that Kenny_Strawn is making.
Sorry, I don't think that the laughing is inappropriate here: he has done this repeatedly in other threads and told (at first, nicely) half a dozen times that he needs to get the basics of programming mastered before posting nonsensical code which from what I can tell he doesn't even test.
Quote:
Originally Posted by Kenny_Strawn
Reported. This is rude and an ad hominem attack. I've had enough ridicule.
Actually I could explain why it isn't and ad hominem attack, but what's the point? You'd just arrogantly proclaim that you're the one who's right. So far you have completely ignored everyone's suggestions to help you, even though you are supposedly seeking for help.
I believe the OP solved the problem soon after posting it, and edited the solution into the first post, but neglected to mark the thread solved.
For anyone confused about the original problem, the following line of code
Code:
unsigned long rgbCube = Red * Green * Blue;
gave a confusing error message when it was included directly in the body of a class definition.
That is an invalid line of code directly in a class definition. But the compiler is not designed to recognize what such a line of code would mean elsewhere and tell you clearly that you can't do that in a class definition. Instead, the compiler reads up to the '=' and at that point realizes that nothing valid in the current context could have an '=' there.
The OP corrected it by changing a class into a function.
I am now trying to use members of a struct (_GdkColor) in an included file as part of the function, and when I do I get the following *NEW* compilation error:
Code:
librgbamap.c:7: error: expected ‘)’ before ‘.’ token
What is causing this? Isn't the whole point of locating struct members to use dots, even if inside parentheses or brackets?
I am now trying to use members of a struct (_GdkColor) in an included file as part of the function, and when I do I get the following *NEW* compilation error:
Code:
librgbamap.c:7: error: expected ) before . token
What is causing this? Isn't the whole point of locating struct members to use dots, even if inside parentheses or brackets?
You haven't shown your full source code.
You haven't shown your full command line.
You haven't shown the above command line full screen output.
I am now trying to use members of a struct (_GdkColor) in an included file as part of the function, and when I do I get the following *NEW* compilation error:
Code:
librgbamap.c:7: error: expected ) before . token
What is causing this?
Compiler messages are often unclear. That error message doesn't tell us much more than it tells you.
At that '.' the compiler ran out of possibilities for valid interpretations of your code. C++ is a complicated language, so there might be valid interpretations well past the actual point of error. So the fact that the '.' can't be valid there means little and the fact that a ')' could be valid there means even less.
How can you expect anyone to tell you what is wrong with your code, when you didn't show the code?
Quote:
Isn't the whole point of locating struct members to use dots, even if inside parentheses or brackets?
You seem to be making flawed assumptions about the nature of the problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.