Results 1 to 10 of 10

Thread: Is it Geany or my problem???

  1. #1
    Join Date
    May 2008
    Location
    Singapore
    Beans
    49
    Distro
    Ubuntu 8.04 Hardy Heron

    Is it Geany or my problem???

    Hey! i just created a simple hello world program in Geany:
    Code:
    #include <iostream>
    
    int main(int argc, char** argv)
    {
    	cout << "Hello World!" << endl;
    	
    	return 0;
    }
    But got this errors:
    project.cpp:28: error: ‘cout’ was not declared in this scope
    project.cpp:28: error: ‘endl’ was not declared in this scope

    Is there something wrong with my program or is there something about Geany that is not letting me compile it?

    Thanks!
    Ubuntu: The Ultimate OS!
    Windows: Bill Gates' Ultimate OS... (p.s. its never free) -.-

  2. #2
    Join Date
    Mar 2008
    Beans
    1,076
    Distro
    Ubuntu

    Re: Is it Geany or my problem???

    you need to use namespace std
    PHP Code:
    #include <iostream>
    using namespace std;
    int main(int argcchar** argv)
    {
        
    cout << "Hello World!" << endl;
        
        return 
    0;

    or
    PHP Code:
    #include <iostream>
    int main(int argc,char**argv)
    {
    std::cout<<"hello again"<<std::endl;
    return 
    0;

    if you do not use the namespace std.
    please buy this online only compilation to support victims of japan. http://www.punk4japan.com/

  3. #3
    Join Date
    May 2008
    Location
    Singapore
    Beans
    49
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Is it Geany or my problem???

    thanks! You saved my life
    Ubuntu: The Ultimate OS!
    Windows: Bill Gates' Ultimate OS... (p.s. its never free) -.-

  4. #4
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Is it Geany or my problem???

    Quote Originally Posted by phantomgunex View Post
    Hey! i just created a simple hello world program in Geany:

    Is there something wrong with my program or is there something about Geany that is not letting me compile it?

    Thanks!
    Are you just learning C++ and doing a test run or did you not know about namespaces?

  5. #5
    Join Date
    May 2008
    Location
    Singapore
    Beans
    49
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Is it Geany or my problem???

    lol i am learning c++. i borrowed "C++ for dummies" from the library and it used dev-c++ but i could not compile the source i downloaded, so i used geany but apperently i cannot just copy the codes into the book just like that. The header used in the book is
    Code:
    #include <iostream>
    #include <stdlib.h>
    but i cant use it in geany.
    Ubuntu: The Ultimate OS!
    Windows: Bill Gates' Ultimate OS... (p.s. its never free) -.-

  6. #6
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Is it Geany or my problem???

    Quote Originally Posted by phantomgunex View Post
    lol i am learning c++. i borrowed "C++ for dummies" from the library and it used dev-c++ but i could not compile the source i downloaded, so i used geany but apperently i cannot just copy the codes into the book just like that. The header used in the book is
    Code:
    #include <iostream>
    #include <stdlib.h>
    but i cant use it in geany.
    That book is...weird.

    iostream is a C++ like, stdlib.h is for C (cstdlib would be for C++)

    If you are just starting programming, I suggest you check out the stickies, my site, and wiki. I started with C++ from a book I randomly got, I regret it.

  7. #7
    Join Date
    May 2008
    Location
    Singapore
    Beans
    49
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Is it Geany or my problem???

    ya... but it worked in my Windows com. I am using dev-c++ in my windows com and it worked like a charm but i cant do it in geany...
    Ubuntu: The Ultimate OS!
    Windows: Bill Gates' Ultimate OS... (p.s. its never free) -.-

  8. #8
    Join Date
    May 2008
    Location
    Singapore
    Beans
    49
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Is it Geany or my problem???

    hmmm... anyone know any GOOD IDEs??? i wanna try them... Oh ya is there a way to install dev-c++ for linux.
    Ubuntu: The Ultimate OS!
    Windows: Bill Gates' Ultimate OS... (p.s. its never free) -.-

  9. #9
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Is it Geany or my problem???

    Quote Originally Posted by phantomgunex View Post
    hmmm... anyone know any GOOD IDEs??? i wanna try them... Oh ya is there a way to install dev-c++ for linux.
    No, there is no such thing as a good ide. See the stickies

    Dev C++ uses the windows port of gcc. You can actually use that to compile directly.

    I suggest you learn how to use gcc and g++ with any editor.

  10. #10
    Join Date
    Dec 2006
    Location
    Australia
    Beans
    1,097
    Distro
    Xubuntu 15.10 Wily Werewolf

    Re: Is it Geany or my problem???

    As LaRoza said, just use an editor and the gcc and g++ compilers from the command line.

    IDEs are quite distracting when learning a new language.

    Geany is actually a very nice code editor, and can even be used as a very basic IDE.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •