Re: [anjuta-list] Need help with string functions usage in Anjuta on Open Suse 12.2



Hi!

gets and cout are declared in the std namespace so either use std::cout or using namespace std.

Johannes

"Ravindra B. Bodhe" <rbodhe airtelmail in> schrieb:

Hello,

I am student and want to use Anjuta for C++ assignments.
However, even for simple code (which appears to be correct) the system throws errors.

I am unable to find the reason.
If you can help me and tell the cause and solution it will help me. Also, if you could point to a useful tutorial on 'C++ program construction in Anjuta', it will help.

Appreciate your response.

Thank you,
Regards,
Ankur

#include <iostream>
#include <string>

using namespace std;

int main()
{
    char pstr [50];

    cout << "Hello World";
   
  gets (pstr);
    strcat (pstr, "Cricket");
    cout << pstr;

   
    return 0;
}

Compilation error message:

main.cc:32:13: error: ‘gets’ was not declared in this scope
main.cc:33:25: error: ‘strcat’ was not declared in this scope


This code was was modification to the standard C++ template  created by Anjuta on Suse 12.2.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]