Thread: Visual Studio 2015 errors

  1. #1
    Registered User
    Join Date
    Apr 2016
    Posts
    2

    Visual Studio 2015 errors

    It seems every c++ code I write in visual studio 2015 gives me errors but the codes come from c++ books and tutorials from websites etc. It seems alot of new stuff is required when it comes to programming c++ in windows. For example I never had to use stdafx.h before and I'll I needed to use was "using namespace std;" after the iostream include.
    I'm a beginner so I'm starting out with console programs.

    Can anyone recommend me a good resource for learning c++ in the windows environment?

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    The stdafx.h requirement comes from using precompiled headers. Either remember to always include stdafx.h in the beginning of every file or disable them. You can also read up on what they are and why realize why they're on by default.

    "using namespace std;" isn't a requirement for code at all. That really depends on what kind of tutorials and code from books use, so that varies between sources.

    It should not be difficult to get started as C++ in the windows environment isn't different at all. It's no different from other environments. If you're still having trouble, I suggest you post some code that doesn't work so we can look at it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Apr 2016
    Posts
    2
    ok thx ill read up on that.

  4. #4
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    Quote Originally Posted by adamthing View Post
    ok thx ill read up on that.
    Or being a beginner, if using visual studio just add the required includes, that is, 'stdafx.h' for the meantime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can't code in C on Visual studio 2015 :(
    By The coder in forum C Programming
    Replies: 2
    Last Post: 12-18-2015, 07:10 AM
  2. Visual Studio 2015 — CPU Usage Profiling Not Working?
    By BobLoblaw465634 in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2015, 09:46 PM
  3. Replies: 1
    Last Post: 08-08-2015, 01:02 PM
  4. SDL on visual studio errors! i need help!
    By jazon in forum C++ Programming
    Replies: 3
    Last Post: 03-20-2013, 01:02 PM
  5. Replies: 1
    Last Post: 12-17-2011, 12:47 PM