Hi.

I'm trying to use brace-initialization notation:

int number{}; 

But I get the following error: "expected an expression". Shouldn't c++11 allow this kind of initialization?

int number2(4)

works just fine.

Thank you.

What compiler are you using? MSVS 2013 does not have an issue with it. Also if you want to intialize number with 4 using braces you would use int number{4};

Hi.

I'm usuing Visual Studio 12 with latest updates on Win7.

I tired

int number{4};

too, and still nothing.

Are you using Visual Studio 2012? I don't know of a Visual Studio 12 unless you are talking about version 12. If you go to Help -> About you will get a window like the attached. Post it here.

Yes, that one.

2cf298de3a8b7f741f51ea9f9c723771

119d9404b3f30cc41b180e055d4c55dd

You are running Visual Studio 2012 which is version 11. version 11 has little to no c++11 support. You need to go to version 2013 update 3 to get te best support that Microsoft offers.

Thank you for your time and help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.