First off here's my code:
[code]
#include <iostream>
#include "test2.h"
using namespace std;
//static int Array[4] = {0,0,0,0};
int e = 0;
int main(){
int e=123;
ChangeMkr::ChangeMkr Mech1;
ChangeMkr::MakeChange(e);
//cout statement here
} [/code]
The Changemkr class is defined in test2.h and is defined to accept a single int, then fills the array.
The error I get when I compile is:
test2.cpp:12: error: cannot call member function ‘void ChangeMkr::MakeChange(int)’ without object
Anything I have looked up on this error doesn't make sense to me, can anyone here help me out?
ChangeMkr::MakeChange(e);
Should be: Mech1.MakeChange( e );
Somewhere I overlooked that, thanks.
hm...now sorry for asking this here but since there is a good example...why not ?
void ChangeMkr::MakeChange(int)
My question is how can that work ? Does it not need to be (void) ? I was told that if the function is a viod than the value (correct me if that's not what it's called) in the () must be void or at least can't be int ?
P.S. I'm currently learning C++ in Boreland C ( I know its old but my teacher detests devC++ and makes us use that ) if there is some difference explain to me. If not can you please explain the whole thing ? I really wanna learn.
[url=http://www.learncpp.com/cpp-tutorial/14-a-first-look-at-functions/]This[/url] should be a good guide. You probably can skip to "Return values", but it also wouldn't hurt to read the stuff above, even if you already know about it.
Dev-C++ is also old :)
Thanks :3
BTW can anyone tell me the difference between the different versions of C++ ? I've only heard of devC++ (which is the they are going to teach us at my school) and the BorlandC (some kind of old C++ which has a Help menu and that's why my teacher is using it. Its only me and 1 more friend and the teacher said that borlandC is a good start because of the help menu. She also hates devC++. Later in normal classes ...(because the one where I learn borlandC is after all the other classes and is like optional and stuff and there are only 4 people going to it(including me))... we're gonna learn devC++ )
Thanks again :3
[QUOTE=Metaknigth;20341133]Thanks :3
BTW can anyone tell me the difference between the different versions of C++ ? I've only heard of devC++ (which is the they are going to teach us at my school) and the BorlandC (some kind of old C++ which has a Help menu and that's why my teacher is using it. Its only me and 1 more friend and the teacher said that borlandC is a good start because of the help menu. She also hates devC++. Later in normal classes ...(because the one where I learn borlandC is after all the other classes and is like optional and stuff and there are only 4 people going to it(including me))... we're gonna learn devC++ )
Thanks again :3[/QUOTE]
Borland is a really old compiler collection that includes C and C++. It has an IDE that is equally old.
DevC++ is a free IDE that uses the GNU Compiler Collection (also includes C and C++), but it too is getting really old and dated.
If you want a free IDE that you can get shipped with GCC, go get Code::Blocks instead.
To clarify, there are no "different versions of C++". C++ is a standardized programming language, which implementations (like Borland, GCC and MSVC (the Microsoft compiler)) are of varying standard compliance. Borland is terribly old and has a lot of non-standard stuff in its standard library. GCC, MSVC and ICC (Intel C/C++ Compiler) along with commercial compilers are of generally high quality and good C++ standard compliance (although MSVC is not up-to-date on C). For plain C, you also have quality compilers like TCC (Tiny C Compiler) and Clang (LLVM front-end).
In short, don't get a Borland compiler. If you can help it, don't get DevC++ either.
It's just about the standard and the standard compliance.
There's C++98, C++03 and the future-standard known as C++0x, sometimes referred to as C++1x.
Before the first C++ standard in 1998, the language was already used as discussed by Bjarne Stroustrup in the 90s and the different compilers had sometimes quite different dialects.
To make writing portable code easier it was standardized.
This basically means, that old compilers will in some cases not compile newer standard-compliant C++, as well as standard-compliant compiler might not compile the older dialects.
You should look for a modern IDE to make sure, that you are coding valid C++. I'd suggest the Microsoft Visual Studio Express Editions, though they are quite large and I'm not sure if you can run it on a USB-Stick.
For this CodeLite or Code::Blocks is worth a look. They are available not only for Windows, whereas MSVS is.
ninja'd
It's C++1x now, in case you missed it, we've just hit 2010.
[QUOTE=Metaknigth;20341133]Thanks :3
BTW can anyone tell me the difference between the different versions of C++ ? I've only heard of devC++ (which is the they are going to teach us at my school) and the BorlandC (some kind of old C++ which has a Help menu and that's why my teacher is using it. Its only me and 1 more friend and the teacher said that borlandC is a good start because of the help menu. She also hates devC++. Later in normal classes ...(because the one where I learn borlandC is after all the other classes and is like optional and stuff and there are only 4 people going to it(including me))... we're gonna learn devC++ )
Thanks again :3[/QUOTE]
:geno:
Ditch that school. Now.
DevC++ is garbage. BorlandC is ... well, if DevC++ is garbage, then BorlandC is nuclear waste.
Honestly, you're better off learning on your own than with a class so outdated and incompetent that its using BorlandC or DevC++.
[QUOTE=nullsquared;20343480]:geno:
Ditch that school. Now.
DevC++ is garbage. BorlandC is ... well, if DevC++ is garbage, then BorlandC is nuclear waste.
Honestly, you're better off learning on your own than with a class so outdated and incompetent that its using BorlandC or DevC++.[/QUOTE]
You gotta admit the humour in a school using software from something called "Bloodshed Software", though :v:
[QUOTE=blankthemuffin;20342074]It's C++1x now, in case you missed it, we've just hit 2010.[/QUOTE]
C++0xA? :)
Well thanks for the help :downs:
The school is shit and I know I'm better off learning online... so Might as well get to it...problem is I don't know jack shit (the only thing that makes me think I think I know something is when I ask someone from my class something to do with programming and languages they go " Durr wtf is that ?" a friend of mine recently when "I got so hyped up on programming ! I wanna make a game ! Lets make a GAme ! C'mon lets make something like CS:S I mean that can't be hard ? C'mon ! ! ! " When at that moment I just stopped and faceplanted myself against the nearest tree (we were one the stree)) ...
Well fuck i got carried away :D
OK back on track. I wanted to ask about a lot of stuff and what they mean. Hears some I can just remember ATM what is IDE ? and I saw in another thread a term API I think it was ? I also don't know what GCC and MSVS is and all those ...can't remember the the English word for the short thing ...like the phrase Oh My God when its O.M.G. or without the dots OMG <- I can't remember whats that called... :|
Anyway thanks for the Advice ... also just to through this out maybe you guys can help me out. There was this game made by NovemberDobby (here is the post [url]http://www.facepunch.com/showpost.php?p=19219272&postcount=684[/url] )
and I couldn't start it (I downloaded it because It looked fun but then I though that maybe I could play around with the code and see what it at least looks like) So there was this file named rotation and I thought that thats where you started it from it was a application so I double clicked it and nothing happened. ( I asked a friend and he only gave me a link to the XNA development site. I download Microsoft Game Studio 3.0 and Microsoft Visual C# 2008 Express Edition (it was a pack so it can with a couple of other stuff) ) Not knowing pretty much anything I still wasn't able to play it. I would guess that Microsoft Game Studio is something with which you can make a simple and shitty game with (from what i read on the site).
Thanks a lot for the help :3 you people are good kind and awesome. And sorry for going a bit ...well everywhere and off topic here and there...and for the long post but... I wanna learn. Truly I do :3
[b]Edit :[/b]
Sorry If I already asked this but I don't see it ^up there...so ... What is C# ? is there a difference between C++ and C# ? ( as far as I know devC++ = C++ )
Thanks for the help and sorry for asking stupid questions... I know whats its like answering boring stuff to newbies.
[b]Edit :[/b]
Forget about the IDE thing. I now know it means Integrated Development Environment :3
[QUOTE=Metaknigth;20362426]and I saw in another thread a term API I think it was ?[/QUOTE]
[url=http://en.wikipedia.org/wiki/Application_programming_interface]Application Programming Interface[/url]
[QUOTE=Metaknigth;20362426]I also don't know what GCC and MSVS is and all those[/QUOTE]
GCC is the [url=http://gcc.gnu.org/]GNU Compiler Collection[/url], which provides the standard C and C++ compiler used on GNU/Linux systems. MSVS is Microsoft Visual Studio.
[QUOTE=Metaknigth;20362426]...can't remember the the English word for the short thing ...like the phrase Oh My God when its O.M.G. or without the dots OMG <- I can't remember whats that called... :|[/QUOTE]
I think the word you're looking for is "acronym".
[QUOTE=Metaknigth;20362426]Sorry If I already asked this but I don't see it ^up there...so ... What is C# ? is there a difference between C++ and C# ? ( as far as I know devC++ = C++ )[/QUOTE]
C# is a languge created by Microsoft for the .NET Framework. It's actually more like Java than like C or C++.
OK thanks a lot :3 you people are really friendly and helpful.
Sorry, you need to Log In to post a reply to this thread.