By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,388 Members | 1,780 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,388 IT Pros & Developers. It's quick & easy.

Compilation error in "Hello World" program.

P: n/a
PG
Hi gurus,

I have AIX visual age C++ compiler version 5.0.2.3. I have a simple
hello world program that gives compilation errors. Any help will be
appreciated. Thanks

PG
***test.cpp****

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>

int main()
{
cout << "Hello World" << endl;
return 0;
}
***end test.cpp****

****Errors:****
$ cc test.cpp
"/usr/vacpp/include/stdlib.h", line 123.13: 1540-0040 (S) The text
"llabs" is unexpected. "undef" may be undeclared or ambiguous.
****End of Errors:****
****Software Version****
lslpp -l | grep vacpp

vacpp.Dt.common 5.0.2.0 COMMITTED VisualAge C++ Desktop
vacpp.Dt.ide 5.0.2.0 COMMITTED VisualAge C++ IDE
Desktop
vacpp.Dt.techide 5.0.2.0 COMMITTED VisualAge C++ IDE
Tech Preview
vacpp.cmp.C 5.0.2.0 COMMITTED VisualAge C++ C
Compiler
vacpp.cmp.aix50.lib 5.0.2.4 COMMITTED VisualAge C++
Libraries for
vacpp.cmp.batch 5.0.2.4 COMMITTED VisualAge C++ Batch
Compiler
vacpp.cmp.core 5.0.2.3 COMMITTED VisualAge C++
Compiler
vacpp.cmp.extension 5.0.2.3 COMMITTED VisualAge C++
Extension
vacpp.cmp.include 5.0.2.4 COMMITTED VisualAge C++
Compiler Include
vacpp.cmp.incremental 5.0.2.3 COMMITTED VisualAge C++
Incremental
vacpp.cmp.lib 5.0.2.4 COMMITTED VisualAge C++
Libraries
vacpp.cmp.rte 5.0.2.0 COMMITTED VisualAge C++
Compiler
vacpp.cmp.tools 5.0.2.4 COMMITTED VisualAge C++ Tools
vacpp.html.EN_US 5.0.0.0 COMMITTED VisualAge C++
Documentation
vacpp.html.SBCS 5.0.2.0 COMMITTED VisualAge C++
Documentation
vacpp.html.common 5.0.2.0 COMMITTED VisualAge C++
Documentation
vacpp.html.en_US 5.0.0.0 COMMITTED VisualAge C++
Documentation
vacpp.html.help 5.0.2.0 COMMITTED VisualAge C++ HTML
Help Engine
vacpp.ide 5.0.2.3 COMMITTED VisualAge C++ IDE
vacpp.ioc.aix50.rte 5.0.2.1 COMMITTED IBM Open Class
Library AIX 5.0
vacpp.ioc.rte 5.0.2.1 COMMITTED IBM Open Class
Library
vacpp.lic 5.0.2.0 COMMITTED VisualAge C++ Licence
Files
vacpp.loc.en_US.cmp.core 5.0.2.3 COMMITTED VisualAge Compiler
C++ Locale
vacpp.msg.en_US.cmp.batch 5.0.2.0 COMMITTED VisualAge Batch
Compiler C++
vacpp.msg.en_US.cmp.core 5.0.2.3 COMMITTED VisualAge Compiler
C++
vacpp.msg.en_US.cmp.tools 5.0.2.0 COMMITTED VisualAge C++ Tools
vacpp.msg.en_US.html.help 5.0.2.0 COMMITTED VisualAge C++ Help
Engine
vacpp.msg.en_US.ide 5.0.2.3 COMMITTED VisualAge C++ IDE
vacpp.msg.en_US.ioc.rte 5.0.2.1 COMMITTED IBM Open Class
Library Runtime
vacpp.msg.en_US.rescmp 5.0.2.0 COMMITTED VisualAge C++
Resource
vacpp.rescmp 5.0.2.0 COMMITTED VisualAge C++
Resource
vacpp.Dt.common 5.0.2.0 COMMITTED VisualAge C++ Desktop
vacpp.Dt.ide 5.0.2.0 COMMITTED VisualAge C++ IDE
Desktop
vacpp.Dt.techide 5.0.2.0 COMMITTED VisualAge C++ IDE
Tech Preview
vacpp.cmp.core 5.0.2.3 COMMITTED VisualAge C++
Compiler
vacpp.html.EN_US 5.0.0.0 COMMITTED VisualAge C++
Documentation
vacpp.html.SBCS 5.0.2.0 COMMITTED VisualAge C++
Documentation
vacpp.html.common 5.0.2.0 COMMITTED VisualAge C++
Documentation
vacpp.html.en_US 5.0.0.0 COMMITTED VisualAge C++
Documentation
vacpp.html.help 5.0.2.0 COMMITTED VisualAge C++ HTML
Help Engine
vacpp.loc.en_US.cmp.core 5.0.2.3 COMMITTED VisualAge Compiler
C++ Locale
****End of Software Version****
Jul 22 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a

"PG" <pg******@yahoo.com> wrote in message
news:12*************************@posting.google.co m...
Hi gurus,

I have AIX visual age C++ compiler version 5.0.2.3. I have a simple
hello world program that gives compilation errors. Any help will be
appreciated. Thanks

PG
***test.cpp****

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
Non standard header file.

int main()
{
cout << "Hello World" << endl;
return 0;
}
***end test.cpp****

****Errors:****
$ cc test.cpp
"/usr/vacpp/include/stdlib.h", line 123.13: 1540-0040 (S) The text
"llabs" is unexpected. "undef" may be undeclared or ambiguous.
****End of Errors:****


If a compiler can't compile its own header files that would indicate to me
that it is wrongly installed. Obviously that is beyond the scope of this
group.

However you might like to try the following legal C++ program (yours was not
legal) to see if you get any further.

#include <iostream>

int main()
{
std::cout << "hello, world\n";
}

Note the name of the header file <iostream>, <iostream.h> is not a standard
C++ header file. Also note the use of std::cout rather than cout.

I don't think either of these corrections explain the error message above
however.

john

Jul 22 '05 #2

P: n/a
PG wrote:
#include <stdio.h>
#include <stdlib.h>
You don't need those.
#include <iostream.h>

int main()
{
cout << "Hello World" << endl;
return 0;
}


Jul 22 '05 #3

P: n/a

"Bill Seurer" <se****@us.ibm.com> wrote in message
news:c7***********@news.rchland.ibm.com...
PG wrote:
#include <stdio.h>
#include <stdlib.h>


You don't need those.


Well no, but's it not incorrect to have them.
#include <iostream.h>


Unlike the above header.

john
Jul 22 '05 #4

P: n/a

A couple of things

1) do a 'which cc' and make sure you're pointing to /usr/vacpp/bin
and not /usr/vac/bin. If you're pointing to 'vac' then modify
your PATH to add /usr/vacpp/bin to the front of it.

2) use xlC instead of cc

3) Don't call the program 'test' ... there's a Unix command of the
same name and if you don't have '.' in your PATH, you're going
to be even more confused when you get it compiled =8-)

Cheers

Jeff Herrick

ps...Notwithstanding the other remarks re your header files, your
example compiles and links okay on my 5.1 box when I follow
the steps above

On 7 May 2004, PG wrote:
Hi gurus,

[snip]


Jul 22 '05 #5

P: n/a
joe
pg******@yahoo.com (PG) writes:
I have AIX visual age C++ compiler version 5.0.2.3. I have a simple
hello world program that gives compilation errors. Any help will be
appreciated. Thanks

PG
***test.cpp****

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>

int main()
{
cout << "Hello World" << endl;
return 0;
}
***end test.cpp****

****Errors:****
$ cc test.cpp
"/usr/vacpp/include/stdlib.h", line 123.13: 1540-0040 (S) The text
"llabs" is unexpected. "undef" may be undeclared or ambiguous.
****End of Errors:****


Are you sure 'cc' is a C++ compiler? On the AIX box I have access to
the C++ compiler is called xlC, and cc is a C compiler.

Joe
--
"Surprise me"
- Yogi Berra when asked where he wanted to be buried.
Jul 22 '05 #6

P: n/a
jo*@invalid.address wrote:
Are you sure 'cc' is a C++ compiler? On the AIX box I have access to
the C++ compiler is called xlC, and cc is a C compiler.


Good point, plus the fact that the V5 compiler is out of service,
and their install is woefully back-level (you can still get the
5.0.2.9 update from the service website).

--
Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
__________________________________________________ ______________________
Jul 22 '05 #7

P: n/a
Gary R. Hook wrote:
jo*@invalid.address wrote:
Are you sure 'cc' is a C++ compiler? On the AIX box I have access to
the C++ compiler is called xlC, and cc is a C compiler.

Good point, plus the fact that the V5 compiler is out of service,
and their install is woefully back-level (you can still get the
5.0.2.9 update from the service website).

????
cc merely invokes xlC with certain default options. xlC is the C
compiler you need vacpp or some such to do c++, no?

Jul 22 '05 #8

P: n/a
joe
"Timothy J. Bogart" <tb*****@frii.net> writes:
Gary R. Hook wrote:
jo*@invalid.address wrote:
Are you sure 'cc' is a C++ compiler? On the AIX box I have access to
the C++ compiler is called xlC, and cc is a C compiler.

Good point, plus the fact that the V5 compiler is out of service,
and their install is woefully back-level (you can still get the
5.0.2.9 update from the service website).

????
cc merely invokes xlC with certain default options. xlC is the C
compiler you need vacpp or some such to do c++, no?


Well, on our machines, xlc invokes the C compiler with configured
options. xlC invokes the C++ compiler with configured options. I'm not
sure how 'cc' fits into this scheme, hence my question.

Joe
--
"Surprise me"
- Yogi Berra when asked where he wanted to be buried.
Jul 22 '05 #9

P: n/a
pg******@yahoo.com (PG) wrote in message news:<12*************************@posting.google.c om>...
Hi gurus,

I have AIX visual age C++ compiler version 5.0.2.3. I have a simple
hello world program that gives compilation errors. Any help will be
appreciated. Thanks

PG
***test.cpp****

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>

int main()
{
cout << "Hello World" << endl;
return 0;
}
***end test.cpp****

****Errors:****
$ cc test.cpp
"/usr/vacpp/include/stdlib.h", line 123.13: 1540-0040 (S) The text
"llabs" is unexpected. "undef" may be undeclared or ambiguous.
****End of Errors:****


This seems to be a known issue, see APAR IY23677 (TEXT "LLABS"
UNEXPECTED COMPILING STDLIB.H).

Cheers,
z
Jul 22 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.