nvme1986 / terminal-ide

Automatically exported from code.google.com/p/terminal-ide
0 stars 1 forks source link

How to compile a hello.cpp with string type #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have a c++ code like this:

  1 #include <string.h>
  2 using namespace std;
  3 int main()
  4 {
  5     string s = "HelloWorld!"
  6     cout << s << endl;
  7     return 0;
  8 }

I tried to change #include <string>,
but the result is alway error:

helloworld.cpp: In function 'int main()':
helloworld.cpp:5: error: 'string' was not declared in this scope
helloworld.cpp:5: error: expected ';' before 's'

Original issue reported on code.google.com by crex...@gmail.com on 3 Apr 2013 at 3:51

GoogleCodeExporter commented 9 years ago
you  use cout without iostream... great!
p.s b4 complaining  to developer about "defects", you'd better learn language's 
basics, jenius

Original comment by pripiat....@gmail.com on 13 May 2013 at 12:52

GoogleCodeExporter commented 9 years ago
What does jenius mean?

Original comment by crex...@gmail.com on 17 Jun 2013 at 9:16

GoogleCodeExporter commented 9 years ago
Let's ignore the basic errors in example code.

As it's written in the Terminal IDE in-app help files, the C++ header files 
don't work. They compile but segfault. As the help file suggest you can use the 
C header files, but if you do, the code you write won't be a real C++ code, but 
just normal C code with some C++ features.
IMHO C++ without it's headers isn't C++ but is just C, since you can't use the 
base C++ classes, like cin, cout, and so on...
IMHO this should be marked as high-priority blocker Issue, since it prevents 
any real C++ coding.

Original comment by pws...@gmail.com on 2 Jul 2013 at 8:53

GoogleCodeExporter commented 9 years ago
It's very kind of you.

Original comment by crex...@gmail.com on 18 Aug 2013 at 3:32

GoogleCodeExporter commented 9 years ago
Has anyone been able to get the g++ compiler to use c++ headers such as 
iostream yet?

Original comment by akamel1...@gmail.com on 28 Feb 2014 at 2:58

GoogleCodeExporter commented 9 years ago
akamel1, I have installed c4droid with gcc plugin, copied the entire gcc folder 
from data of c4droid to Terminal IDE system to execte compiler as non-root and 
now i can std::cout<<"Hello STL"; :D

Original comment by 8841sieg...@gmail.com on 24 Jun 2014 at 12:31

GoogleCodeExporter commented 9 years ago
/*
 * Comment to state the purpose of this program (filename.cpp)
 */
#include <iostream>
using namespace std;

int main() {
   // Your Programming statements HERE!

   return 0;
}

try to compile this code 
note-but before compiling this change the preference of c4droid to g++ +bionic
you will success 
please send a comment after read my blog

Original comment by rr335...@gmail.com on 9 Mar 2015 at 1:54