Author Topic: Can't brace initialize struct even with -stdc++11 enabled  (Read 4273 times)

Raezzor

  • Guest
Can't brace initialize struct even with -stdc++11 enabled
« on: September 22, 2014, 10:58:20 pm »
Hey guys, sorry if this has been asked and answered before. I tried search function but got a lot of irrelevant results. Anywho...

I used to use CB before and had no problem using the C++11 standard. Mostly dabbling, hobby-level programming and such. I recently wanted to get back into to write a console app for figuring out some values for a game but I've run into an issue. Basically I have a bunch of structures that I want to brace initialize but it keeps throwing the
Code
in C++98 'Veld' must be initialized by constructor, not by '{...}'|
errors on me for each and every structure. I have the -stdc++11 box checked in the GNU GCC compiler option. Any idea why it's still throwing this error? Here's my code so far, it's quite incomplete as I just wanted to run a quick build to find any errors I had so far.:

Code
#include <iostream>

using std::cout;
using std::cin;
using std::endl;

struct ORE
{
    float fOreValue = 0;
    int nTrit = 0;
    int nPyer = 0;
    int nMex = 0;
    int nIso = 0;
    int nNocx = 0;
    int nMega = 0;
    int nZyd = 0;
    int nMorph = 0;
};

int main()
{
    ORE Veld = {0, 415};
    ORE CVeld = {0, 436};
    ORE DVeld = {0, 457};
    ORE Scord = {0, 346, 173};
    ORE CScord = {0, 363, 182};
    ORE MScord = {0, 380, 190};
    ORE Pyro = {0, 351, 25, 50, 0, 5};
    ORE SPyro = {0, 368, 26, 53, 0, 5};
    ORE VPyro = {0, 385, 27, 55, 0, 5};



    return 0;
}

Thanks for the help, this is bugging the poop outta me. :p

PS: Yes this is for EVE online. :p

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Can't brace initialize struct even with -stdc++11 enabled
« Reply #1 on: September 22, 2014, 11:05:32 pm »
Please respect our forum rules !
Especially:
[...]
1. This is NOT a general programming board. "How do I write a program that....", "Can anybody teach me how to", "I have this homework", "My program doesn't run and I don't have the slightest idea of why because I'm a C++ newcomer", "What is a compiler", "What does gcc do" is the kind of questions that is FORBIDDEN to ask.

2. Compiler/Linker errors are NOT Code::Blocks errors. Usually, C++ newcomers tend to confuse the Editor/IDE (Code::Blocks) with the Compiler (MINGW / GCC). You may see some errors in the compiler output because you missed to do something right in your code. But that's not Code::Blocks troubleshooting, that's C++ troubleshooting and does not belong in here. If your program doesn't compile, READ THE C++ MANUAL.

3. Is your problem library, framework specific? There are appropriate forums for it, not the Code::Blocks forum.
[...]
Thank you.

Finale note: Ignoring these rules may result in the topic being (silently) locked and/or even removed completely without any notice.

In case you wonder why we are so strict: I could say: "Search the forum" - as this has been discussed a lot. To make is short: By law we (the devs/moderators) are responsible for the content of our forum. This means we need to read all posts. If you want us to continue the development of C::B and have the time to answer some of the questions that are really related to C::B, apply the rules above. It's obviously a matter of time for us.
[...]

Topic locked !!