I am trying to learn some basic C++ over the summer for school next semester. However, I am running into a lot of very basic problems just getting started. I am trying to run the Eclipse IDE, so I installed the IDE with C/C++ support, as well with a Java IDK (Which Eclipse was telling me it needed). I got eclipse up and running, but whenever I attempt to write a basic hello world program, I get errors.
I get red underlines under the #include <iostream> and cout parts of the code. under #include <iostream> it says "unresolved inclusion: <iostream>", and under cout it says "symbol 'cout' could not be resolved". If I try to run the program, it tells me "Launch Failed. Binary Not Found." I have had similarly frustrating problems with other IDE's, such as Netbeans. I have tried using the return command at the end, but that does not fix anything. I suspect that I am doing something small wrong, or maybe have not installed all the neccesary components or something, but I can not figure out what. Any insight or advice would be much appreciated.
If you notice I made it very compressed but what I changed was I added getchar(); at the end. That was your problem and I know it is because I tested it several different ways and this for some reason was the only one that worked.
I don't believe that is the issue. They're having issues compiling, and none of the things you pointed out actually help compile the program.
I do believe that the issue is the Eclipse IDE. I tried using it before I returned to Code::Blocks and it refused to compile. I was under the impression that the compiler that it came with was also a C++ compiler, but I believe it only can compile JAVA, which makes it a bad IDE imho. There is a bunch of things that you'll never need in it, and doesn't even have a built in compiler for what you want. Unless, I, like the OP, did something wrong, which is completely possible, I have steered away from Eclipse. It also seems very bloated due to the environment targeting JAVA development and not C++.
I would prefer using the Code::Blocks IDE with the MingW compiler. Just google Code::Blocks and when you get to the download page, I believe there is an option to include the MingW compiler. Choose that one and install. The IDE is a bare minimum, but has everything I've needed so far from an IDE.
Also, besides that you should try visual c++ express if you don't like any of those. And the usingnamespace std;
I have read that it could cause problems in future when using multiple classes and different namespaces so it is often better to call the namespace when you are writing the code std::cout << "You'r mom is a pineapple" << std::endl;
I didn't say that your program didn't work, I'm saying that I don't believe that the OP was having issues with the IDE they were using. I am not a fan of the Eclipse IDE since I don't believe it comes with a compiler and since it's targetted more towards JAVA development.
You're correct, the using namespace std; call isn't suggested as when you use another namespace, you could end up with conflicting names.