You are not logged in.

#1 2009-04-14 06:51:58

frashman
Member
Registered: 2009-04-06
Posts: 8

HelloWorld don't work in eclipse-cdt ... !!

Hi all,

can anybody tell me, what i'm doing wrong here?

i have installed eclipse-cdt with pacman and in my second try i downloaded it from eclipse.org.
I always get the same problems ..

I created a new Hello World c++ project, but i couldn't compile it successfully.

**** Build of configuration Debug for project test2 ****

make all 
Building file: ../src/test2.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test2.d" -MT"src/test2.d" -o"src/test2.o" "../src/test2.cpp"
../src/test2.cpp:9:20: warning: iostream: No such file or directory
../src/test2.cpp: In function 'int main()':
../src/test2.cpp:13: error: 'cout' was not declared in this scope
../src/test2.cpp:13: error: 'endl' was not declared in this scope
make: *** [src/test2.o] Error 1

Looks like the compiler don't find the includes and librarys. By default the include search paths for the compiler are
/usr/inlude
/usr/local/include

Then I added to the include path
/usr/include/c++/4.3.3
and to the librarys paths
/usr/lib
/usr/local/lib

then i got this result

**** Build of configuration Debug for project test ****

make all 
Building file: ../src/test.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include -I/usr/include/c++/4.3.3 -I/usr/local/include -O0 -g3 -Wall -MMD -MP -MF"src/test.d" -MT"src/test.d" -o"src/test.o" "../src/test.cpp"
In file included from /usr/include/c++/4.3.3/iosfwd:46,
                 from /usr/include/c++/4.3.3/ios:44,
                 from /usr/include/c++/4.3.3/ostream:45,
                 from /usr/include/c++/4.3.3/iostream:45,
                 from ../src/test.cpp:9:
/usr/include/c++/4.3.3/bits/stringfwd.h:46: error: expected constructor, destructor, or type conversion before '(' token
/usr/include/c++/4.3.3/bits/stringfwd.h:55: error: expected type-specifier before 'allocator'
/usr/include/c++/4.3.3/bits/stringfwd.h:55: error: expected '>' before 'allocator'
/usr/include/c++/4.3.3/bits/stringfwd.h:60: error: template argument 3 is invalid
/usr/include/c++/4.3.3/bits/stringfwd.h:60: error: invalid type in declaration before ';' token
/usr/include/c++/4.3.3/bits/stringfwd.h:68: error: '_GLIBCXX_END_NAMESPACE' does not name a type
In file included from /usr/include/c++/4.3.3/cwchar:49,
                 from /usr/include/c++/4.3.3/bits/postypes.h:47,
                 from /usr/include/c++/4.3.3/iosfwd:47,
                 from /usr/include/c++/4.3.3/ios:44,
                 from /usr/include/c++/4.3.3/ostream:45,
                 from /usr/include/c++/4.3.3/iostream:45,
                 from ../src/test.cpp:9:
/usr/include/c++/4.3.3/cstddef:57: error: '::size_t' has not been declared
In file included from /usr/include/c++/4.3.3/bits/postypes.h:47,
                 from /usr/include/c++/4.3.3/iosfwd:47,
                 from /usr/include/c++/4.3.3/ios:44,
                 from /usr/include/c++/4.3.3/ostream:45,
                 from /usr/include/c++/4.3.3/iostream:45,
                 from ../src/test.cpp:9:
/usr/include/c++/4.3.3/cwchar:61: error: expected constructor, destructor, or type conversion before 'extern'
In file included from /usr/include/c++/4.3.3/ios:45,
                 from /usr/include/c++/4.3.3/ostream:45,
                 from /usr/include/c++/4.3.3/iostream:45,
                 from ../src/test.cpp:9:
/usr/include/c++/4.3.3/exception:40: error: expected declaration before end of line
make: *** [src/test.o] Error 1

by the way, if i take a other short c++ project and do the "make all" on console ... it works ..

any help?
Thanks

Offline

#2 2009-04-14 08:25:06

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: HelloWorld don't work in eclipse-cdt ... !!

I use a build command 'make' for my C project, a 'dirty' quick fix (I maintain the Makefile myself).

Offline

#3 2009-04-15 09:09:58

frashman
Member
Registered: 2009-04-06
Posts: 8

Re: HelloWorld don't work in eclipse-cdt ... !!

if i disable the automatic build command and setup 'make' it's still the same result.

any other suggestion?

thx

Offline

#4 2009-04-15 11:02:47

joephantom
Member
From: Latinoamérica
Registered: 2008-01-09
Posts: 94
Website

Re: HelloWorld don't work in eclipse-cdt ... !!

I have the same problem here. This week I tried to install eclipse from pacman, and I also tried downloading the cdt version from eclipse.org, to my girlfriend's computer and I have the same problem you have. When I compile within eclipse, g++ can't find standard libraries. Invoking g++ from the shell, works as it should.
The strange thing is that in my main computer eclipse is able to compile perfectly.


By striving to do the impossible, man has always achieved what is possible. Those who have cautiously done no more than they believed possible have never taken a single step forward - Mikhail Bakunin

Offline

#5 2011-02-05 22:59:49

yaxi
Member
Registered: 2011-02-05
Posts: 1

Re: HelloWorld don't work in eclipse-cdt ... !!

simply having Eclipse and CDT doesn't mean you have g++.
I had exactly the same problem.
Then I installed g++ and restarted Eclipse.  The problem went away.

Offline

#6 2011-02-05 23:14:06

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: HelloWorld don't work in eclipse-cdt ... !!

yaxi - welcome to the boards, please read the Forum Etiquette, particularly the necro-bumping entry:

https://wiki.archlinux.org/index.php/Fo … Bumping.27

Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB