2

i'm on Ubuntu 13.10 64Bit and i have a problem where i cannot build a simple Hello World project, i get 3 errors.

How do i solve this ?

enter image description here

ljgw
  • 2,751
  • 1
  • 20
  • 39
  • possible duplicate of [Eclipse CDT: Symbol 'cout' could not be resolved](http://stackoverflow.com/questions/10803685/eclipse-cdt-symbol-cout-could-not-be-resolved) (or at least, take a look at that question) – ljgw Nov 25 '13 at 09:27
  • There's a warning on the `#include` line. What does it say? – laalto Nov 25 '13 at 09:29
  • The problem is not `cout`. The problem is that Eclipse cannot find C++ headers to parse them for declarations. You can try adding the headers manually in include paths. But, I have to say, on linux Eclipse does pretty good job finding headers. Are you sure you have `g++` installed and not just `gcc`? Try `g++ -v` in terminal to check. – lapk Nov 25 '13 at 09:33
  • @laalto "unresolved inclusion " –  Nov 25 '13 at 09:36
  • @PetrBudnik i have g++ installed via XTerm "sudo apt-get install g++" –  Nov 25 '13 at 09:41
  • @ljgw I did saw that thread but i cannot find the solution to MY problem, i've tried what they offered but still didn't work. –  Nov 25 '13 at 09:42
  • @user1803300 Can you locate `iostream` on your machine? What's the path? Use `sudo find / -name iostream` in terminal... And what shows under includes for your project (In Project Manager on the left)? – lapk Nov 25 '13 at 09:43
  • @PetrBudnik i have no idea how to do this, besides i'm new to Linux, how do i locate the path ? –  Nov 25 '13 at 09:43
  • @john I have a terminal window open, what should i do ? –  Nov 25 '13 at 09:46
  • @PetrBudnik i tried running your terminal command and it shows me this. /usr/include/c++/4.8/iostream –  Nov 25 '13 at 09:49
  • 1
    @user1803300 Well, you can manually add `/usr/include/c++/4.8/` to the `Paths and Symbols` of the project in Eclipse (`Include` tab). But something is wrong with either your project or Eclipse install. Try making a new project, use `Linux GCC` toolchain. See if it works alright. – lapk Nov 25 '13 at 09:52
  • @PetrBudnik it is a Linux GCC project btw, i also added /usr/include/c++/4.8/iostream to includes tab, still not working. –  Nov 25 '13 at 09:54
  • @user1803300 It should work if you added it manually. This include should appear in Project Manager on the left as part of the project dependencies. Do you see it? If not, it was not included then correctly by you manually. – lapk Nov 25 '13 at 10:03
  • @PetrBudnik this is how i included it, http://i.stack.imgur.com/Ak8rV.png –  Nov 25 '13 at 10:05
  • @user1803300 I suggest trying creating a brand new project, making sure it's Linux GCC toolchain. Just to make sure. Because it seems your installation of Eclipse might be broken. For example, there might be issues if you installed it as `root`, but trying to run it as `user`. – lapk Nov 25 '13 at 10:22
  • @PetrBudnik Hey, manualy adding "/usr/include/c++/4.8/" worked, but now i have 2 errors left, "symbol cout and endl couldn't be resolved" –  Nov 25 '13 at 14:06
  • @user1803300 Does it compile though with command line? – lapk Nov 26 '13 at 14:46
  • @PetrBudnik I didn't check, but it works fine if i install Ubuntu directly to a partition instead of a Virtual Machine, anyhow problem "solved". –  Nov 26 '13 at 19:03

3 Answers3

1

just use std::cout<<"hi"; instead of cout<<"hi"; that should fix your problem

hivert
  • 10,579
  • 3
  • 31
  • 56
Suraj
  • 11
  • 1
0

Had the same problem, after trying all above but did not work. Then tried the command compiler g++, error was not installed. after installing g++ compiled and worked. then started eclipse and problem was solved. conclusion must install g++ first..

0

For me it worked fine when I put the source file inside a source folder in eclipse. It seems to be a PATH configuration for building all the project.

Falcao
  • 1