2

EDIT: I have updated the title question and removed the information those involved have already read, to reduce the sea of text and narrow down the problem/question.

I have been trying to learn C++ the past 2 days right from the beginning following this tutorial.

This tutorial is awesome, but I believe the software it is linking me to is either outdated, or I am unable to find the application to run it on my computer. I have tried start search, explorer search, navigating the start menu, navigating the C drive, but I am not sure where exactly it would be.

Could anyone please help with me the proper link to the right software, or tell me where it would save on your computer? I don't recall it giving me an option to choose where it is being installed to.

The tutorial introduced ranged for loops using this syntax:

for ( declaration : range ) statement;

My IDE is erroneous, expecting a semi-colon after declaration and an expression. This brought it down to what I think is using the incorrect IDE or not having a plugin/something properly updated. I understand the ranged for loop, but my computer doesn't want to compile it.

Thank you for your time in reading and I appreciate any time taken to help me get the right software running.

Regards

Kirbyarm
  • 29
  • 5
  • 1
    Hi and welcome to stackoverflow. The question in its current form is very broad and at times unclear. If you try to break it down into smaller, more focused questions you will have more luck getting useful answers. – Benjamin Bannier Apr 02 '14 at 07:37
  • In my opinion there is no such thing as 'proper' development environment for lerning C++. Also, in my opinion, it would be better to learn from a good book, look here: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list – Dino Apr 02 '14 at 07:38
  • 1
    I apologize, I was having difficulty summarizing the exact question in the title, but if I had a chance to refine what was asked after reading these helpful responses, it would be: "where can I find the proper IDE for the tutorial I'm currently trying to follow?" The problem was despite following where it directed me to download the IDE, it seems to have lead me to an outdated one, which is understandable. – Kirbyarm Apr 02 '14 at 07:56
  • You already have your answer in the first answer: Download Visual Studio 2013 Express. – Suma Apr 02 '14 at 08:37
  • Funny thing is, I already had downloaded and installed Visual Studio 2013 Express. Despite all of our efforts and beliefs, the problem was ridiculously more simple than we thought. I search "visual" and "studio" on my computer when looking for the program itself. This brought up Microsoft Visual C++ 2010 Express every time. This time I tried 2013 express and it popped up as "VS Express 2013 for Desktop". Well, I'll be. – Kirbyarm Apr 02 '14 at 10:30
  • Just to confirm, I have resolved the issue and located the program. I just tried to re-compile all of the previous ones that gave me errors, and they all work! Thank you everyone! – Kirbyarm Apr 02 '14 at 10:40

2 Answers2

1

Your range based for loop is a C++11 feature and not supported in Visual C++ 2010. Try to get a newer one, the 2012 version should do the trick.

Concerning the R in front of the string: it's a raw string literal. This is supported by Visual C++ 2013.

For more information see Microsoft's documentation http://msdn.microsoft.com/de-de/library/hh567368.aspx

I think there is no right or wrong environment to learn C++. But your compiler should support the features needed by your tutorial. Try the newest Visual C++ you can get. Or change to a tutorial with less cutting edge C++ stuff. There is enough to learn without.

usr1234567
  • 21,601
  • 16
  • 108
  • 128
  • 2
    The `R` is not an error. See e.g. [this](http://solarianprogrammer.com/2011/10/16/cpp-11-raw-strings-literals-tutorial/) – rubenvb Apr 02 '14 at 07:46
  • @rubenvb Thanks for the hint, I forgot about that as I never used it myself. Updated the answer. – usr1234567 Apr 02 '14 at 07:49
0

Microsoft has historically been quite slow to catch up with changes to the C and C++ standards; indeed, in some cases, it has seemed to actively resist standard compliance (e.g. the scope of for-loop variables, C99). Worse, in others, it has taken a balmy and over-the-top position (for instance, MS stuck underscores on all of the POSIX compatibility functions in its C library, purportedly to comply with the C standard; the main effect of this is to make portability more awkward).

So, if you are following an older tutorial, or one aimed specifically at Windows developers, you will probably not have too many problems. If, on the other hand, you are following a tutorial that requires your compiler to be standards compliant, you may run into the odd issue using Visual C++ and you might want in that case to consider other compilers.

Additionally, make sure when using Visual C++ that, where possible, you're using the very latest version of the compiler. Microsoft does improve things over time, so newer compilers are certainly more standards compliant and support newer versions of the standards.

al45tair
  • 4,405
  • 23
  • 30
  • Yeah, that's exactly where I got my current IDE from. It has since been rebooted at the appropriate times, and installed a total of two times, Visual Studio Express for Windows Desktop 2013. The same installer is now processing for a third time, and I will reboot once more and see if I can find that program. – Kirbyarm Apr 02 '14 at 08:03
  • 1
    There might be a separate setting somewhere that you have to turn on to activate C++11 support. – uliwitness Apr 02 '14 at 08:30