Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error in code from Dev-C++ (windows) to aCC (UNIX)

Status
Not open for further replies.

tistklehoff

Programmer
Jul 6, 2005
1
0
0
FR
Hello all. I've a problem with a program compiled in my work-machine under win2k with Dev-C++ (gcc compiler).

It works perfectly in my computer, but I need to run it in a server, running under UNIX O.S.

My UNIX compiler is aCC. I'm trying to compile, but aCC throws one error:
Error 697: "main.cpp", line 8 # Only namespace names are valid here.
using namespace std;
^^^

Next, some errors like this:
Error 187: "main.cpp", line 49 # Referenced object 'is_open' is not a member
of class ifstream ["/opt/aCC/include/iostream/fstream.h", line 78].
if (!prop_file.is_open()){
^^^^^^^

I tried many different options in aCC, reading man entries, but don't work...

My aCC is in /opt/aCC (/bin exe file, /include and /include_std inc files), compiler order: aCC file.cpp, aCC -I /opt/aCC/include file.cpp, and many others

header files:

#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;
...

if I take old C headers (iostream.h, stdlib.h and so on) throws the same error list, if I erase namespace clause, throws many errors like: cout is not defined in current namespace, string is not defined in current namespace...


Thankyou all (and sorry for my english, it is not too good)
 
Which version of HPUX are you using? 10.20 or 11.0
 
Does this work?
Code:
#include <iostream>
int main ()
{
   std::cout << "Hello" << endl;
   return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top