Thread: Beginner Needs help in Dev-C++

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    8

    Beginner Needs help in Dev-C++

    Hey Everyone,
    I just started reading a C++ book and I'm trying to follow along but for some reason the code doesn't compile and run. The book uses Dev-C++. I type in the code exactly how it is in the book but nothing comes up like it's supposed to. Here is the code it has me to enter in the compiler.


    Code:
     #include <iostream>
               #include <stdlib.h>
            
               int main(int argc, char *argv[])
    {
        cout << "Hello, I am your computer talking." <<endl;
        system("PAUSE") ;
        return 0;
    }
    any help would be greatly appreciated.

    I don't know why this won't compile and run

    Thanks in Advance

  2. #2
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    404
    In order to use cout/endl, you need the namespace std. You can either use this by declaring it in the global scope, or preceding both cout/endl with a std::

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    903
    This is because cout and endl are located in the std namespace. Don't worry about this right now, just put "using namespace std;" without quotes before int main().

    Next time you post though you may want to give us the errors the compiler is reporting. It makes us easier to know what is the problem.

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    8
    I'll try to list the errors here.

    I don't know why it's being like this. all I'm doing is following this from a book I'm reading


    Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\Makefile.win"
    Executing make...
    make.exe -f "C:\Dev-Cpp\Makefile.win" all
    g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include"

    In file included from C:/Dev-Cpp/include/c++/iosfwd:46,
    from C:/Dev-Cpp/include/c++/ios:44,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/bits/fpos.h:60: error: `streamoff' does not name a type

    C:/Dev-Cpp/include/c++/bits/fpos.h:74: error: expected `)' before "__off"
    C:/Dev-Cpp/include/c++/bits/fpos.h:77: error: `streamoff' has not been declared
    C:/Dev-Cpp/include/c++/bits/fpos.h:80: error: declaration of `operator+=' as non-function
    C:/Dev-Cpp/include/c++/bits/fpos.h:80: error: expected `;' before '(' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:82: error: expected `;' before "fpos"
    C:/Dev-Cpp/include/c++/bits/fpos.h:83: error: declaration of `operator-=' as non-function
    C:/Dev-Cpp/include/c++/bits/fpos.h:83: error: expected `;' before '(' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:85: error: expected `;' before "fpos"

    C:/Dev-Cpp/include/c++/bits/fpos.h:86: error: declaration of `operator+' as non-function
    C:/Dev-Cpp/include/c++/bits/fpos.h:86: error: expected `;' before '(' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:93: error: expected `;' before "fpos"
    C:/Dev-Cpp/include/c++/bits/fpos.h:94: error: declaration of `operator-' as non-function
    C:/Dev-Cpp/include/c++/bits/fpos.h:94: error: expected `;' before '(' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:101: error: expected `;' before "bool"
    C:/Dev-Cpp/include/c++/bits/fpos.h:109: error: `streamoff' does not name a type
    C:/Dev-Cpp/include/c++/bits/fpos.h:113: error: variable or field `_M_position' declared void
    C:/Dev-Cpp/include/c++/bits/fpos.h:113: error: expected `;' before '(' token

    C:/Dev-Cpp/include/c++/bits/fpos.h:114: error: expected `;' before '}' token
    C:/Dev-Cpp/include/c++/bits/fpos.h: In constructor `std::fpos<_StateT>::fpos()':

    C:/Dev-Cpp/include/c++/bits/fpos.h:72: error: class `std::fpos<_StateT>' does not have any field named `_M_off'
    C:/Dev-Cpp/include/c++/bits/fpos.h:72: error: there are no arguments to `streamoff' that depend on a template parameter, so a declaration of `streamoff' must be available
    C:/Dev-Cpp/include/c++/bits/fpos.h:72: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
    C:/Dev-Cpp/include/c++/bits/fpos.h: In member function `bool std::fpos<_StateT>:perator==(const std::fpos<_StateT>&) const':
    C:/Dev-Cpp/include/c++/bits/fpos.h:103: error: `_M_off' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/fpos.h:103: error: (Each undeclared identifier is reported only once for each function it appears in.)
    C:/Dev-Cpp/include/c++/bits/fpos.h: In member function `bool std::fpos<_StateT>:perator!=(const std::fpos<_StateT>&) const':
    C:/Dev-Cpp/include/c++/bits/fpos.h:107: error: `_M_off' undeclared (first use this function)

    In file included from C:/Dev-Cpp/include/c++/ios:46,
    from C:/Dev-Cpp/include/c++/ostream:45,

    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/bits/char_traits.h: At global scope:
    C:/Dev-Cpp/include/c++/bits/char_traits.h:60: error: `streamoff' does not name a type
    C:/Dev-Cpp/include/c++/bits/char_traits.h:114: error: `streamoff' does not name a type

    In file included from C:/Dev-Cpp/include/c++/bits/localefwd.h:46,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/c++locale.h: In function `int std::__convert_from_v(char*, int, const char*, _Tv, int* const&, int)':
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/c++locale.h:68: error: `snprintf' is not a member of `std'

    In file included from C:/Dev-Cpp/include/c++/string:53,
    from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/bits/basic_string.h: In member function `void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_dispose(const _Alloc&)':
    C:/Dev-Cpp/include/c++/bits/basic_string.h:186: error: there are no arguments to `__exchange_and_add' that depend on a template parameter, so a declaration of `__exchange_and_add' must be available
    C:/Dev-Cpp/include/c++/bits/basic_string.h: In member function `_CharT* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_refcopy()':
    C:/Dev-Cpp/include/c++/bits/basic_string.h:196: error: there are no arguments to `__atomic_add' that depend on a template parameter, so a declaration of `__atomic_add' must be available

    In file included from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,

    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/bits/localefwd.h: In member function `void std::locale::_Impl::_M_add_reference()':
    C:/Dev-Cpp/include/c++/bits/localefwd.h:322: error: `__atomic_add' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/localefwd.h: In member function `void std::locale::_Impl::_M_remove_reference()':
    C:/Dev-Cpp/include/c++/bits/localefwd.h:327: error: `__exchange_and_add' undeclared (first use this function)

    C:/Dev-Cpp/include/c++/bits/localefwd.h: In member function `size_t std::locale::id::_M_id() const':
    C:/Dev-Cpp/include/c++/bits/localefwd.h:462: error: `__exchange_and_add' undeclared (first use this function)

    In file included from C:/Dev-Cpp/include/c++/ios:49,
    from C:/Dev-Cpp/include/c++/ostream:45,

    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/bits/ios_base.h: At global scope:
    C:/Dev-Cpp/include/c++/bits/ios_base.h:240: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/bits/ios_base.h:241: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/bits/ios_base.h:360: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/bits/ios_base.h:363: error: `streamsize' does not name a type

    C:/Dev-Cpp/include/c++/bits/ios_base.h:371: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/bits/ios_base.h:374: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/bits/ios_base.h: In member function `void std::ios_base::_Callback_list::_M_add_reference()' :
    C:/Dev-Cpp/include/c++/bits/ios_base.h:261: error: `__atomic_add' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/ios_base.h: In member function `int std::ios_base::_Callback_list::_M_remove_reference ()':
    C:/Dev-Cpp/include/c++/bits/ios_base.h:265: error: `__exchange_and_add' undeclared (first use this function)

    In file included from C:/Dev-Cpp/include/c++/ios:50,
    from C:/Dev-Cpp/include/c++/ostream:45,

    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/streambuf: At global scope:
    C:/Dev-Cpp/include/c++/streambuf:55: error: expected constructor, destructor, or type conversion before "__copy_streambufs"
    C:/Dev-Cpp/include/c++/streambuf:55: error: expected `;' before "__copy_streambufs"
    C:/Dev-Cpp/include/c++/streambuf:82: error: `streamsize' does not name a type

    C:/Dev-Cpp/include/c++/streambuf:269: error: `streamsize' has not been declared
    C:/Dev-Cpp/include/c++/streambuf:287: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/streambuf:329: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/streambuf:344: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/streambuf:415: error: `streamsize' has not been declared
    C:/Dev-Cpp/include/c++/streambuf:432: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/streambuf:435: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/streambuf:464: error: `streamsize' does not name a type

    In file included from C:/Dev-Cpp/include/c++/bits/basic_ios.h:41,
    from C:/Dev-Cpp/include/c++/ios:51,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:448: error: `streamsize' has not been declared

    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In constructor `std::numpunct_byname<_CharT>::numpunct_byname(con st char*, size_t)':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:564: error: there are no arguments to `_S_create_c_locale' that depend on a template parameter, so a declaration of `_S_create_c_locale' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:565: error: there are no arguments to `_M_initialize_numpunct' that depend on a template parameter, so a declaration of `_M_initialize_numpunct' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In destructor `virtual std::numpunct_byname<_CharT>::~numpunct_byname()':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:571: error: there are no arguments to `_S_destroy_c_locale' that depend on a template parameter, so a declaration of `_S_destroy_c_locale' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In constructor `std::collate_byname<_CharT>::collate_byname(const char*, size_t)':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:928: error: `_M_c_locale_collate' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:928: error: `_S_c_locale' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:929: error: there are no arguments to `_S_destroy_c_locale' that depend on a template parameter, so a declaration of `_S_destroy_c_locale' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:930: error: there are no arguments to `_S_create_c_locale' that depend on a template parameter, so a declaration of `_S_create_c_locale' must be available

    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In constructor `std::moneypunct_byname<_CharT, _Intl>::moneypunct_byname(const char*, size_t)':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1520: error: there are no arguments to `_S_create_c_locale' that depend on a template parameter, so a declaration of `_S_create_c_locale' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1521: error: there are no arguments to `_M_initialize_moneypunct' that depend on a template parameter, so a declaration of `_M_initialize_moneypunct' must be available

    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In destructor `virtual std::moneypunct_byname<_CharT, _Intl>::~moneypunct_byname()':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1527: error: there are no arguments to `_S_destroy_c_locale' that depend on a template parameter, so a declaration of `_S_destroy_c_locale' must be available

    In file included from C:/Dev-Cpp/include/c++/bits/locale_facets.h:1743,
    from C:/Dev-Cpp/include/c++/bits/basic_ios.h:41,
    from C:/Dev-Cpp/include/c++/ios:51,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h: At global scope:
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h:39: error: redefinition of `std::messages<_CharT>::messages(size_t)'
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1640: error: `std::messages<_CharT>::messages(size_t)' previously declared here
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h: In constructor `std::messages<_CharT>::messages(size_t)':
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h:40: error: there are no arguments to `_S_get_c_locale' that depend on a template parameter, so a declaration of `_S_get_c_locale' must be available

    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h: At global scope:
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h:44: error: redefinition of `std::messages<_CharT>::messages(int*, const char*, size_t)'
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1646: error: `std::messages<_CharT>::messages(int*, const char*, size_t)' previously declared here
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h: In constructor `std::messages<_CharT>::messages(int*, const char*, size_t)':
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h:45: error: there are no arguments to `_S_get_c_locale' that depend on a template parameter, so a declaration of `_S_get_c_locale' must be available
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h: At global scope:
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h:56: error: redefinition of `std::messages<_CharT>::~messages()'
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1671: error: `virtual std::messages<_CharT>::~messages()' previously declared here
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h:77: error: invalid use of undefined type `struct std::messages_byname<_CharT>'
    C:/Dev-Cpp/include/c++/bits/localefwd.h:176: error: declaration of `struct std::messages_byname<_CharT>'
    C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32/bits/messages_members.h:77: error: template definition of non-template `std::messages_byname<_CharT>::messages_byname(con st char*, size_t)'
    In file included from C:/Dev-Cpp/include/c++/bits/basic_ios.h:41,
    from C:/Dev-Cpp/include/c++/ios:51,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In constructor `std::messages_byname<_CharT>::messages_byname(con st char*, size_t)':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1756: error: `_M_name_messages' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1757: error: `_M_c_locale_messages' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1757: error: `_S_c_locale' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1758: error: there are no arguments to `_S_destroy_c_locale' that depend on a template parameter, so a declaration of `_S_destroy_c_locale' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:1759: error: there are no arguments to `_S_create_c_locale' that depend on a template parameter, so a declaration of `_S_create_c_locale' must be available

    In file included from C:/Dev-Cpp/include/c++/iostream:45,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/ostream: At global scope:

    C:/Dev-Cpp/include/c++/ostream:161: error: `streamsize' has not been declared

    In file included from C:/Dev-Cpp/include/c++/istream:45,
    from C:/Dev-Cpp/include/c++/iostream:46,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/limits:48:29: bits/cpu_limits.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/iostream:46,
    from main.cpp:1:
    C:/Dev-Cpp/include/c++/istream:71: error: `streamsize' does not name a type

    C:/Dev-Cpp/include/c++/istream:147: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/istream:158: error: `streamsize' has not been declared
    C:/Dev-Cpp/include/c++/istream:161: error: `streamsize' has not been declared
    C:/Dev-Cpp/include/c++/istream:172: error: `streamsize' has not been declared
    C:/Dev-Cpp/include/c++/istream:175: error: `streamsize' has not been declared
    C:/Dev-Cpp/include/c++/istream:179: error: expected `;' before '(' token
    C:/Dev-Cpp/include/c++/istream:185: error: `streamsize' has not been declared
    C:/Dev-Cpp/include/c++/istream:187: error: `streamsize' does not name a type
    C:/Dev-Cpp/include/c++/istream: In constructor `std::basic_istream<_CharT, _Traits>::basic_istream(std::basic_streambuf<_Char T, _Traits>*)':
    C:/Dev-Cpp/include/c++/istream:79: error: `_M_gcount' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/istream:79: error: there are no arguments to `streamsize' that depend on a template parameter, so a declaration of `streamsize' must be available
    C:/Dev-Cpp/include/c++/istream: In destructor `virtual std::basic_istream<_CharT, _Traits>::~basic_istream()':
    C:/Dev-Cpp/include/c++/istream:84: error: `_M_gcount' undeclared (first use this function)
    C:/Dev-Cpp/include/c++/istream:84: error: there are no arguments to `streamsize' that depend on a template parameter, so a declaration of `streamsize' must be available

    main.cpp: In function `int main(int, char**)':

    main.cpp:6: error: `cout' undeclared (first use this function)

    main.cpp:6: error: `endl' undeclared (first use this function)

    make.exe: *** [main.o] Error 1

    Execution terminated


    I just copied everything in that area. I'm sorry to anyone if that's frustrating but I am really new with this stuff and this book won't do it right i guess because different things happen when i try it myself than in the book.

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    903
    Did you make the modifications we have suggested ?

    Also, you may want to change <stdlib.h> to <cstdlib>.

  6. #6
    Registered User
    Join Date
    Apr 2009
    Posts
    8
    how would the code look after the modifications?

  7. #7
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    404
    Does the C++ book you are using fail to put "using namespace std;" in this example program? If so, I would recommend getting another book.

    As I said, put it in the global scope. This is where you put all your function definitions, defines, inclusions, etc.

  8. #8
    Registered User
    Join Date
    Apr 2009
    Posts
    8
    I don't even think I'm that far in to the book for it to talk about that yet. I don't know though.

    I just want to learn this stuff but I'm have a difficult time with it. I know it's possible to learn though

    thanks for your time

  9. #9
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Korrupt Lawz View Post
    I don't even think I'm that far in to the book for it to talk about that yet. I don't know though.

    I just want to learn this stuff but I'm have a difficult time with it. I know it's possible to learn though

    thanks for your time
    Just do one simple thing. Add this line as the first line inside the curly braces after main:

    Code:
    using namespace std;
    Does that make the errors go away?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #10
    Registered User
    Join Date
    May 2007
    Posts
    147
    Korrupt Lawz:

    Other's here have your answer, I just wanted to address your last point.

    It was true for nearly all of us that in the early phase of study, it seems daunting.

    It's also true that all of us made it through that phase, and you will too if you keep the attitude of your last clause - if so many have made it through that phase, you can too.

    There's a 'critical mass' of information that must build up before it begins to fall into place. Even afterwards, there will appear stages where you find yourself stuck like this, but persistence will pay off. The languages, the entire technology, was designed to work and it does work. I can't count how many times, during my early years, I insisted the compiler had gone nuts and simply wasn't understanding my code, or that it was NOT doing what it should be doing. That view has never persisted, though - there's always a reason behind it. If nothing else, that's a main theme in this study. You might find yourself in disagreement with the reasoning, you might think it's illogical at first, but this is a variation of the same thing. If you have the time to follow along the full extent of the reasoning, it makes a lot more sense in the long run.

    Best of luck - it will come to you just like it finally came to each of us.

  11. #11
    Registered User BuzzBuzz's Avatar
    Join Date
    Feb 2009
    Posts
    89
    I'd like to echo JVene on the perseverence note.

    Personally (and I'm still at the very basic beginning stages of learning C++) I had to go through four different C++ books before I found one that spoke to me in a way that actually clicked. However, from each book I learnt a bit more, and when I got to a section in the next book that I'd had trouble with there were a lot of "Ahhhhh now I get it!" moments. I could have given up as soon as I hit the first hurdle, but I thought there must be a different approach so had a look at a different resource and although it was teaching the same thing, the way it was taught made it easier to understand.

    To cut through the guff, don't limit your learning to one book (especially one that misses out 'using namespace std;' or references to it in the very first program) - there are a load of resources now online (FREE) to look at as well as a gazillion books (I'd avoid the "learn C++ in 30 seconds/24 hours/ a week" type books though).
    Last edited by BuzzBuzz; 04-27-2009 at 06:25 AM.
    Any help I give may be classified as:
    The Blind leading the Blind...
    Currently working through:
    "C++ Primer Plus"

  12. #12
    Registered User
    Join Date
    Apr 2009
    Posts
    8
    The modifications you guys told me to put in didn't work. I opened a 2nd C++ book but couldn't get the code to work in that from the book either so now I'm on my 3rd book.

  13. #13
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Looks like your Dev-C++ installation is screwed up. Those errors are coming from inside system headers, before it even gets to your code.

    Why would you blame the book?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  14. #14
    Registered User
    Join Date
    Apr 2009
    Posts
    8
    I didn't know that. I just thought it was the book because I was told to try other books rather than just one and I don't really know how to read those errors yet.

  15. #15
    Registered User
    Join Date
    May 2009
    Posts
    16
    Quote Originally Posted by Korrupt Lawz View Post
    I didn't know that. I just thought it was the book because I was told to try other books rather than just one and I don't really know how to read those errors yet.
    i would suggest using visual c++ from microsoft if you are running windows, its a very nice compiler/ide combo.

    also, microsoft also has a nice c++ tutorial, here are some links:


    the tutorial: C++ Beginner's Guide
    the compiler: Visual C++ 2008 Express Edition
    a very good book on c++ thats free: Bruce Eckel's Free Electronic Books

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 11:48 AM
  2. Whats better, C-Free or Dev C++??
    By i_can_do_this in forum Tech Board
    Replies: 10
    Last Post: 07-07-2006, 04:34 AM
  3. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  4. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  5. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM