C++ help
-
- Registered User
- Posts: 8346
- Joined: 10 May 2006, 02:00
- Processor: Intel i5-3750
- Motherboard: Gigabyte
- Graphics card: nVidia GTX 550Ti
- Memory: 8GB Jetram
- Contact:
C++ help
Hi guys,
I'm looking for the best possible way to learn C++. I have experience in Java programming, so I would like something that looks at C++ with Java as a background.
I know of a book called C++ for Java programmers, but I am also interested in online resources. If you know of any, PLEASE give me a shout!!
Thanks!
I'm looking for the best possible way to learn C++. I have experience in Java programming, so I would like something that looks at C++ with Java as a background.
I know of a book called C++ for Java programmers, but I am also interested in online resources. If you know of any, PLEASE give me a shout!!
Thanks!
-
- Registered User
- Posts: 20576
- Joined: 19 Sep 2003, 02:00
- Location: Bloodbank
Re: C++ help
Best thing would be to forget everything you have learned in Java. Take it from someone that needed to do the migration himself. If you don't you will shoot yourself in the foot with assumptions. Rather learn the language from scratch. From Java the only one you can take up with relative ease in terms of how it works and what there is to work with is C#.
- Spoiler (show)
-
- Registered User
- Posts: 8346
- Joined: 10 May 2006, 02:00
- Processor: Intel i5-3750
- Motherboard: Gigabyte
- Graphics card: nVidia GTX 550Ti
- Memory: 8GB Jetram
- Contact:
Re: C++ help
Forgetting Java will make me fail next semester!
But I get what you are saying. Any good articles you can point me to for the beginner? I tried googling, but you get so many claims of code that will turn you into a genius, and I don't know which to trust.
But I get what you are saying. Any good articles you can point me to for the beginner? I tried googling, but you get so many claims of code that will turn you into a genius, and I don't know which to trust.
-
- Registered User
- Posts: 20576
- Joined: 19 Sep 2003, 02:00
- Location: Bloodbank
- rustypup
- Registered User
- Posts: 8872
- Joined: 13 Dec 2004, 02:00
- Location: nullus pixius demonica
- Contact:
Re: C++ help
i disagree... java coding habits are an excellent base to work from ...RuadRauFlessa wrote:Best thing would be to forget everything you have learned in Java.
single inheritance
OOAD
event handling
MVC
c++ will add to DarkRanger's toolkit by introducing:
the preprocessor
memory management and a deeper understanding of leaks and garbage collection..
the power of pointers
a better understanding of reference, value and scope...
real structs...
the joy of operator overloading
multiple inheritance, (and why it's not as good as it sounds)
amongst others...
@DarkRanger: your class design undergoes a paradigm shift because each class is split into 2 files, which means your class template and its implementation don't reside side-by-side as they do in java.
each object you design will need an implicit constructor and destructor, (the java compiler would typically create these for you if omitted)
aside from that, it is worth the effort to go back to basics for now... C++ Tutorial is as good as any starting point... pay attention to pointers, namespaces and scope... these are the high bug producing areas of the language...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
-
- Registered User
- Posts: 20576
- Joined: 19 Sep 2003, 02:00
- Location: Bloodbank
Re: C++ help
I did not mean forget how to code. Just the language. How to code you will always need and the more langs you know the easier it will be to go to the next one.
- Spoiler (show)
- rustypup
- Registered User
- Posts: 8872
- Joined: 13 Dec 2004, 02:00
- Location: nullus pixius demonica
- Contact:
Re: C++ help
ahh... got you... will apply more coffee posthaste...RuadRauFlessa wrote:I did not mean forget how to code. Just the language.
Most people would sooner die than think; in fact, they do so - Bertrand Russel
-
- Registered User
- Posts: 8346
- Joined: 10 May 2006, 02:00
- Processor: Intel i5-3750
- Motherboard: Gigabyte
- Graphics card: nVidia GTX 550Ti
- Memory: 8GB Jetram
- Contact:
Re: C++ help
Thanks for the help guys.
I'll ask again if something comes up.
I'll ask again if something comes up.
-
- Registered User
- Posts: 20576
- Joined: 19 Sep 2003, 02:00
- Location: Bloodbank
Re: C++ help
NP. Just shout around here somewhere and someone is bound to hear itDarkRanger wrote:Thanks for the help guys.
I'll ask again if something comes up.
- Spoiler (show)
-
- Registered User
- Posts: 8346
- Joined: 10 May 2006, 02:00
- Processor: Intel i5-3750
- Motherboard: Gigabyte
- Graphics card: nVidia GTX 550Ti
- Memory: 8GB Jetram
- Contact:
Re: C++ help
Okay, I must be doing something stupid, as I googled the error and I couldn't find an error similar to mine.
Here is my source code:
This is my makefile code:
And here is the error I am getting when I enter make cos121_prac1
Any suggestions to what I might be doing wrong?
Here is my source code:
Code: Select all
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
if(argc < 4)
cout<<"ERROR - Too few arguments passed. Correct usage is ./cos121_prac1 x y z where x y z are positive integers."<<endl;
else if(argc > 4)
cout<<"ERROR - Too many arguments passed. Correct usage is ./cos121_prac1 x y z where x y z are positive integers."<<endl;
else
cout<<"ENOUGH ARGUMENTS PASSED"<<endl;
}
Code: Select all
cos121_prac1 : main.o
g++ -static -main.o -o cos121_prac1
main.o : main.cpp
g++ -static -c main.cpp -o main.o
clean:
rm main.o cos121_prac1
Code: Select all
g++ -static -c main.cpp -o main.o
g++ -static -main.o -o cos121_prac1
g++: no input files
make: *** [cos121_prac1] Error 1
-
- Registered User
- Posts: 8346
- Joined: 10 May 2006, 02:00
- Processor: Intel i5-3750
- Motherboard: Gigabyte
- Graphics card: nVidia GTX 550Ti
- Memory: 8GB Jetram
- Contact:
Re: C++ help
any help?
- rustypup
- Registered User
- Posts: 8872
- Joined: 13 Dec 2004, 02:00
- Location: nullus pixius demonica
- Contact:
Re: C++ help
the compiler is telling you exactly what the issue is... given that it didn't belch during compilation, we have only to glance at:g++: no input files
to find the suspect...g++ -static -main.o -o cos121_prac1
Most people would sooner die than think; in fact, they do so - Bertrand Russel
-
- Registered User
- Posts: 8346
- Joined: 10 May 2006, 02:00
- Processor: Intel i5-3750
- Motherboard: Gigabyte
- Graphics card: nVidia GTX 550Ti
- Memory: 8GB Jetram
- Contact:
Re: C++ help
bows head in shame. Thanks rusty. It works now...rustypup wrote:the compiler is telling you exactly what the issue is... given that it didn't belch during compilation, we have only to glance at:g++: no input filesto find the suspect...g++ -static -main.o -o cos121_prac1