• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Enerjak

C11 initializer lists not working in visual studio 2010/2012

9 posts in this topic

Ok, i got a book about C11 and all the new features about it. One of them is initializer lists like:

[code]

vector<string> name { "Sonic", "Eggman'" };

[/code]

but they all give this error:

[code]

1 IntelliSense: expected a ';' c:\users\rosario\documents\visual studio 2010\projects\fix\fix\fix.cpp 9 10 Fix

[/code]

of when dealing with vectors, this:

[code]

1 IntelliSense: initialization with '{...}' is not allowed for object of type "std::vector<std::string, std::allocator<std::string>>" c:\users\rosario\documents\visual studio 2010\projects\fix\fix\fix.cpp 9 25 Fix

[/code]

not sure what to do.
0

Share this post


Link to post
Share on other sites
I'd suggest using a different compiler if you want to use C++11 features, Visual Studio has some C++11 support but it's severely lacking when compared to other compilers like GCC.

Some new features including initializer lists have been added in the [url="http://blogs.msdn.com/b/vcblog/archive/2012/11/02/visual-c-c-11-and-the-future-of-c.aspx"]November CTP[/url] for VS2012, but this is pre-release software and can therefore be quite buggy (no word yet on a stable release). They also don't provide an updated version of the standard library with it either, so you wouldn't be able to use these new features with structures defined by the standard library.
2

Share this post


Link to post
Share on other sites
[quote name='Radikalizm' timestamp='1354942217' post='5008367']
I'd suggest using a different compiler if you want to use C++11 features, Visual Studio has some C++11 support but it's severely lacking when compared to other compilers like GCC.

Some new features including initializer lists have been added in the [url="http://blogs.msdn.com/b/vcblog/archive/2012/11/02/visual-c-c-11-and-the-future-of-c.aspx"]November CTP[/url] for VS2012, but this is pre-release software and can therefore be quite buggy (no word yet on a stable release). They also don't provide an updated version of the standard library with it either, so you wouldn't be able to use these new features with structures defined by the standard library.
[/quote]

man, what a buzz kill that is.......thanks, amd apperantly chronos lib is not available for 2010 either
0

Share this post


Link to post
Share on other sites
Neither the VC10 or VC11 compilers support initializer lists, see http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx

Your choice is probably quite straightforward:
- Rework the code not to use C++11 initializer lists, or
- Switch to using another compiler that does support them.GCC has initializer lists since GCC 4.4: http://gcc.gnu.org/projects/cxx0x.html . Clang has support for initializer lists since Clang 3.1 http://clang.llvm.org/cxx_status.html . Intel C++ compiler advertizes partial support for initializer lists in 13.0 (I don't know what that means in practice): http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler .
2

Share this post


Link to post
Share on other sites
[quote name='KingofNoobs' timestamp='1354951852' post='5008417']
Can one use the VC11 IDE with the GCC or other compilers?
[/quote]
I know you can use the Intel compiler (google may know more); I haven't heard of anyone using GCC with Visual Studio. Also, I'm not sure if changing compilers impacts any Visual Studio features (like debugging) or not.
0

Share this post


Link to post
Share on other sites
[quote name='Radikalizm' timestamp='1354942217' post='5008367']
I'd suggest using a different compiler if you want to use C++11 features, Visual Studio has some C++11 support but [b][i]it's severely lacking when compared to other compilers[/i][/b] like GCC.
[/quote]

That's not quite a fair statement, at least for VS2012 -- none of the current compilers have full C++ 11 support and each of them implement a different set, so some features might be implemented in one platform and the same feature might be missing from another. Also, some of the compilers that "support" a feature might offer partial support, or support in a way that's not perfectly standards-conforming.

In terms of overall support, the major compilers are not that far apart.

That said, VS lacks support for some of the cooler features like uniform initializers and variadic templates, for which other compilers offer at least some support.
-1

Share this post


Link to post
Share on other sites
[quote name='Ravyne' timestamp='1354956277' post='5008436']
That's not quite a fair statement, at least for VS2012 -- none of the current compilers have full C++ 11 support and each of them implement a different set, so some features might be implemented in one platform and the same feature might be missing from another. Also, some of the compilers that "support" a feature might offer partial support, or support in a way that's not perfectly standards-conforming.

In terms of overall support, the major compilers are not that far apart.

That said, VS lacks support for some of the cooler features like uniform initializers and variadic templates, for which other compilers offer at least some support.
[/quote]

I am doing cross platform development and MSVC is the only compiler that stops me using the C++11. I can use almost all parts of the standard with GCC, good luck with that with VC.

To be fair VS2012 had some basic support for C++11. November CTP added some more, but it doesn't update the STL and intellisense not working. So basically, it's [b]severely lacking[/b] compared to other compilers.
0

Share this post


Link to post
Share on other sites
[quote name='KingofNoobs' timestamp='1354951852' post='5008417']
Can one use the VC11 IDE with the GCC or other compilers?
[/quote]

See the vs-tool plugin in my signature if you want to try using MinGW or Clang from Visual Studio. There are also other plugins like that existing. Note however that the plugin is very experimental at this stage, so it can/may require some hacking and tweaking activities. Here's an example of what it looks like in action: https://dl.dropbox.com/u/40949268/code/vs-mingw.png
2

Share this post


Link to post
Share on other sites
A more objective comparison: [url="http://cpprocks.com/a-comparison-of-c11-language-support-in-vs2012-g-4-7-and-clang-3-1/"]http://cpprocks.com/a-comparison-of-c11-language-support-in-vs2012-g-4-7-and-clang-3-1/[/url]

Note that this comparison table doesn't count the November CTP.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0