LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-26-2013, 06:18 PM   #1
nightrapper
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Rep: Reputation: Disabled
c++ code not getting compiled for ARM platform


Hi,

I'm using eldk tool for fdi-3250 board.I need to compile cpp code on board. For this i written a small cpp code and procedure as follows...

#include<iostream>

using namespace std;
int main()
{
cout<<"Hello World!\n";
return 0;
}

compiled as follows:arm-linux-c++ 1.cpp -o pp

its giving following errors:
1.cpp:2:20: error: iostream: No such file or directory
1.cpp: In function 'int main()':
1.cpp:7: error: 'cout' was not declared in this scope

Please can someone provide me solution for it.
Please let me know if this is the correct place where i have put my query regarding my problem.


Regards&Thanks
nightrapper
 
Old 12-26-2013, 09:59 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by nightrapper View Post
Hi,

I'm using eldk tool for fdi-3250 board.I need to compile cpp code on board. For this i written a small cpp code and procedure as follows...

#include<iostream>

using namespace std;
int main()
{
cout<<"Hello World!\n";
return 0;
}

compiled as follows:arm-linux-c++ 1.cpp -o pp

its giving following errors:
1.cpp:2:20: error: iostream: No such file or directory
1.cpp: In function 'int main()':
1.cpp:7: error: 'cout' was not declared in this scope

Please can someone provide me solution for it.
Please let me know if this is the correct place where i have put my query regarding my problem.


Regards&Thanks
nightrapper

First you need to make sure the 'iostream' file is present in your system.

Second you need to make sure the compiler include paths include the location (directory) of 'iostream'. If not, you'll need to adjust the paths using '-I' command line option.
 
Old 12-27-2013, 01:20 AM   #3
nightrapper
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
hai thank you for your reply.

I am sure that "iostream" file is present in my system
path is "/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2"

and I export the eldk path using below commands

export ARCH=arm
export CROSS_COMPILE=arm-linux-
export PATH=$PATH:/home/akarshana/nxp/eldk42/usr/bin:/home/akarshana/nxp/eldk42/bin:

my second time i tried like

export ARCH=arm
export CROSS_COMPILE=arm-linux-
export PATH=$PATH:/home/akarshana/nxp/eldk42/usr/bin:/home/akarshana/nxp/eldk42/bin:/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2:

even it is giving same error

I did n't get where is the problem?
let me know how to solve this,,I am strucked here please help some one to move further in my
 
Old 12-27-2013, 01:27 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by nightrapper View Post
hai thank you for your reply.

I am sure that "iostream" file is present in my system
path is "/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2"

and I export the eldk path using below commands

export ARCH=arm
export CROSS_COMPILE=arm-linux-
export PATH=$PATH:/home/akarshana/nxp/eldk42/usr/bin:/home/akarshana/nxp/eldk42/bin:

my second time i tried like

export ARCH=arm
export CROSS_COMPILE=arm-linux-
export PATH=$PATH:/home/akarshana/nxp/eldk42/usr/bin:/home/akarshana/nxp/eldk42/bin:/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2:

even it is giving same error

I did n't get where is the problem?
let me know how to solve this,,I am strucked here please help some one to move further in my
Try to add

Code:
-I/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2
to command line.
 
Old 12-27-2013, 01:28 AM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by nightrapper View Post
...
export PATH=$PATH:/home/akarshana/nxp/eldk42/usr/bin:/home/akarshana/nxp/eldk42/bin:/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2:
...
The '/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2' part doesn't make sense - unless you have some executable files in the directory.
 
Old 12-27-2013, 01:47 AM   #6
nightrapper
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
To Sergei Steshenko,

then how can solve my problem its important to compile c++ code. do you know any idea regarding this problem
 
Old 12-27-2013, 01:54 AM   #7
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by nightrapper View Post
To Sergei Steshenko,

then how can solve my problem its important to compile c++ code. do you know any idea regarding this problem
How about http://www.linuxquestions.org/questi...5/#post5087462 ?
 
Old 12-27-2013, 02:16 AM   #8
nightrapper
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
when I use
Quote:
-I/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2
in command line Its giving below error

In file included from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:44:28: error: bits/c++config.h: No such file or directory
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:43,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iosfwd:45:29: error: bits/c++locale.h: No such file or directory
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iosfwd:46:25: error: bits/c++io.h: No such file or directory
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/ios_base.h:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:48,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ext/atomicity.h:39:23: error: bits/gthr.h: No such file or directory
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ext/atomicity.h:40:30: error: bits/atomic_word.h: No such file or directory
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/memory:54,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/string:48,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/locale_classes.h:47,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/ios_base.h:47,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:48,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/allocator.h:53:31: error: bits/c++allocator.h: No such file or directory
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/basic_ios.h:44,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:50,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/locale_facets.h:47:30: error: bits/ctype_base.h: No such file or directory
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/locale_facets.h:1533:31: error: bits/ctype_inline.h: No such file or directory
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/locale_facets.h:3040:33: error: bits/time_members.h: No such file or directory
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/locale_facets.h:4599:37: error: bits/messages_members.h: No such file or directory
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iosfwd:47,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:43,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/cctype:68: error: expected constructor, destructor, or type conversion before '(' token
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/cctype:84: error: '_GLIBCXX_END_NAMESPACE' does not name a type
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iosfwd:48,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:43,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/stringfwd.h:55: error: expected type-specifier before 'allocator'
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/stringfwd.h:55: error: expected '>' before 'allocator'
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/stringfwd.h:60: error: template argument 3 is invalid
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/stringfwd.h:60: error: invalid type in declaration before ';' token
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/cstddef:51,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/cwchar:51,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/postypes.h:46,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iosfwd:49,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:43,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/include/stddef.h:152: error: expected constructor, destructor, or type conversion before 'typedef'
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/cwchar:51,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/postypes.h:46,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iosfwd:49,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:43,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/cstddef:53: error: expected constructor, destructor, or type conversion before '(' token
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ctime:51,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/cwchar:52,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/bits/postypes.h:46,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iosfwd:49,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:43,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/usr/../arm/usr/include/time.h:31: error: expected constructor, destructor, or type conversion before 'extern'
In file included from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ios:44,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/ostream:45,
from /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:45,
from 1.cpp:1:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/exception:40: error: expected declaration before end of line
 
Old 12-27-2013, 02:31 AM   #9
nightrapper
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
but I found
Quote:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/iostream:44:28: error: bits/c++config.h: No such file or directory
this file in

Quote:
/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/arm-linux-gnueabi/bits
then how can i include this file

and there is another error

/home/akarshana/nxp/eldk42/usr/../arm/usr/include/time.h:31: error: expected constructor, destructor, or type conversion before 'extern'

how to solve this error?

Last edited by nightrapper; 12-27-2013 at 02:53 AM.
 
Old 12-27-2013, 02:44 AM   #10
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by nightrapper View Post
but I found
this file in



then how can i include this file
Do you at all understand how 'I<some_path>' works ? Isn't it obvious that you should also add

Code:
-I/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/arm-linux-gnueabi
to your command line (since the missing file is bits/c++config.h and full path to int is /home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/arm-linux-gnueabi/bits ) ?
 
Old 12-27-2013, 03:09 AM   #11
nightrapper
LQ Newbie
 
Registered: Mar 2013
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank you very much sir,
I understood the -I<path>

2nd time I did small mistake sir thats why I am again asked you

I did -I/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/arm-linux-gnueabi/bits
here again I include the "bits" directory by removing this my .cpp file was compiled thanks alot for your suggetions
 
Old 12-27-2013, 03:38 AM   #12
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by nightrapper View Post
...my .cpp file was compiled thanks alot for your suggetions
I know nothing about your IDE/toolchain, but I am sure there mus be a way to add include directories to the IDE/toolchain configuration.

Maybe as trivially as setting CPPFLAGS and CXXFLAGS environment variables,s but RTFM.
 
Old 12-27-2013, 11:19 AM   #13
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Good Sir, you have to use more than -I options in the command line, sir. It will be sg like this, sir:

Code:
arm-linux-c++ 
    -I/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2
    -I/home/akarshana/nxp/eldk42/arm/usr/include/c++/4.2.2/arm-linux-gnueabi
    1.cpp -o pp

Last edited by NevemTeve; 12-27-2013 at 11:21 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ARM Processor with Linux platform Marvin_G Linux - Hardware 9 12-29-2012 10:30 AM
g++ toolchain for ARM platform yuchankit Slackware 3 10-07-2012 12:33 AM
Qemu 0.15.0 compiled on ARM works with Win95 but not XP. Why? OrokuSaki Linux - Virtualization and Cloud 2 09-08-2011 03:19 PM
Error while signing a compiled code for Exadigm PoS running Arm-Linux sunnyben Linux - Newbie 0 05-02-2010 01:29 PM
Cross-compiled wireless_tools_v29 caused segmentation fault on arm-platform mailerlee Linux - Wireless Networking 0 02-26-2008 04:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration