Languages

Menu
Sites
Language
Including C/C++ libs

How can I add different C/C++ libs like <vector>, <string>, <fstream>. If I try to do this,for example, "include <string>, I'll get "file not found". How can I fix this?

Responses

3 Replies
Jeongsu Kim

Please rename your source file with extension ".c" to ".cpp"
 

Alex Dem

Hi,
Yes, rename files as it was proposed above. In cpp project you will able to use it. Something like this works fine:

#include <fstream>
//...
std::fstream fs;
fs.open ("/opt/usr/media/Documents/text.txt",std::fstream::out);
fs << "some text";
fs.close();

with privilege in manifest:      <privilege>http://tizen.org/privilege/mediastorage</privilege>
The same should be for <vector> & <string>
Alexey.

Alex Dem

Also, fyi: for C projects you could:
1) include <string.h> for operations with strings.
2) for operations with files you could use <stdio.h> fopen/fclose/fread/fwrite etc
Alexey.