I just downloaded eclipse for C++/C developers, and created a new hello world project to test that everything is installed right. The hello world program came up with a few errors: Symbol 'cout' could not be resolved, Symbol 'endl' could not be resolved, Symbol 'std' could not be resolved. Does C++ require something like java's JDK in order to compile?
Eclipse for C++/C developers acting weird.
Page 1 of 16 Replies - 1006 Views - Last Post: 22 June 2012 - 02:13 PM
Replies To: Eclipse for C++/C developers acting weird.
#2
Re: Eclipse for C++/C developers acting weird.
Posted 21 June 2012 - 04:44 PM
Do you have using namespace std; in your code?
#3
Re: Eclipse for C++/C developers acting weird.
Posted 21 June 2012 - 04:48 PM
Yes, but that itself is throwing a error.
#4
Re: Eclipse for C++/C developers acting weird.
Posted 21 June 2012 - 09:52 PM
Hi,
Have you included the header <iostream>
at the top of the program ?
#include <iostream>
Snoopy.
Have you included the header <iostream>
at the top of the program ?
#include <iostream>
Snoopy.
#5
Re: Eclipse for C++/C developers acting weird.
Posted 21 June 2012 - 10:09 PM
My guess is you used
gcc foo.cpp
rather than
g++ foo.cpp
You need to use a C++ compiler to compile C++ code.
Whilst you can COMPILE C++ code by invoking gcc, it does not pass all the correct options on to the linker (hence all the undefined reference errors). You need g++ in order to compile AND link.
gcc foo.cpp
rather than
g++ foo.cpp
You need to use a C++ compiler to compile C++ code.
$ gcc foo.cpp /tmp/ccLqikjD.o: In function `fun(int const&)': foo.cpp:(.text+0x54): undefined reference to `std::cout' foo.cpp:(.text+0x59): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)' foo.cpp:(.text+0x66): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)' /tmp/ccLqikjD.o: In function `__static_initialization_and_destruction_0(int, int)': foo.cpp:(.text+0x8f): undefined reference to `std::ios_base::Init::Init()' foo.cpp:(.text+0x94): undefined reference to `std::ios_base::Init::~Init()' /tmp/ccLqikjD.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status $ g++ foo.cpp $ gcc -c foo.cpp
Whilst you can COMPILE C++ code by invoking gcc, it does not pass all the correct options on to the linker (hence all the undefined reference errors). You need g++ in order to compile AND link.
#6
Re: Eclipse for C++/C developers acting weird.
Posted 22 June 2012 - 01:03 PM
Ok guys, First of all, this is autogenerated code. There is no mistakes in it, ok? Second I am using eclipse, not the console
#7
Re: Eclipse for C++/C developers acting weird.
Posted 22 June 2012 - 02:13 PM
Quote
Does C++ require something like java's JDK in order to compile?
Yes it requires a compiler like gcc.
What is the complete name of the file you are trying to compile. I don't remember if you can compile a file, in Eclipse, without first creating a project but I recommend you create a project and add files to your project. Also you may need to inform Eclipse where the compiler is located. I am not familiar enough with this IDE to say exactly how to properly set up the build environment.
Jim
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|