C++ I dont want so-called VS2010 "errors" to be errors

Recommended Posts


I have a game which I originally wrote in DevCpp and Opengl2.0, but now I switched to Visual Studio (2010) and Opengl3.0, cause it allows a lot of things that are mandatory for making the game cool. I had to take VS cause there doesnt exist Devpack for anything else than OpenGl2. So I have run an OpenGl sample in VS2010, and everything is good. But when I loaded my game, it started to throw me a lot of errors, which DevCpp didnt throw, and instead it normally compiled. It is mainly error C2864: "only static const integral data members can be initialized within a class", but there are even some others. I know that I could fix it manually in program, but the rework would be brutal and time-consuming cause the project is BIG. I dont wanna do that. I just want the VS2010 compiler to behave like DevC++ one and normally do its job and compile it for me. I tried some additional command line options like /std=c++11 but it said it doesnt know them. I tried /O1 cause I read somewhere it helps (didnt). It would be really cool if there existed a solution cause I really dont want to manually recheck 70k+ lines (and make additional mistakes during it).

Please help :D

Share this post

Link to post
Share on other sites

In general, newer compilers have better conformance to standards, only straying if the functionality is part of a vendor extension or a long-standing defect with the compiler.

Ill-formed or non-standard code will only become less and less supported, so you don't have much choice than to update your understanding of the language if you wish to move away from ancient toolchains and their quirks.

Share this post

Link to post
Share on other sites

I concur; fixing the warnings is the only course of action.  And even more so, you are upgrading from OpenGL 2.0 to 3.0.

Because this is such a large undertaking, I recommend upgrading your project and continuing development in parallel branches.  Use Visual Studio to fix warnings on one branch, and use Dev-C++ on the other branch.  Upgrade and refactor in small sprints on the upgrade branch and continue developing your game on the other.

Once the project has been fully upgraded, you can take everything you’ve learned from upgrading and migrate your changes on the other branch into your upgraded branch.  (Hopefully you are using some form of version control with those 70k+ lines!)

Good luck!

Share this post

Link to post
Share on other sites

Ideally you should use the most recent version of Visual Studio.  If for some reason you cannot, you should at least upgrade to a Visual Studio version that implements the C++ features you are using (see https://msdn.microsoft.com/en-us/library/hh567368.aspx).  If for some reason you are stuck with VS 2010, you have to change all your code so it only uses the C++ features it supports.

Edited by BFG

Share this post

Link to post
Share on other sites
5 hours ago, Macin2 said:

I just want the VS2010 compiler to behave like DevC++ one and normally do its job and compile it for me.

There's a reason that the newer VS compiler is behaving differently than the one shipped with Dev-C++: the one with Dev-C++ is over a decade old, and very buggy.  The Dev-C++ software contains over 250 known bugs.  Code that "worked" with that compiler is, in fact, incorrect and may exhibit problems in your released product.  Using a modern compiler should also result in better performance.

As others have suggested, you should probably bite the bullet and fix all of the errors in your code.   You'll end up with a better product in the long run - there are reasons that those things are considered errors.

Given you're updating to a newer IDE/compiler, why is your newer choice 7 years old?  There have been several newer versions of Visual Studio since 2010, and each version has a freely available option.  If you for some reason insist on using Dev-C++ for any future projects, at least use the more recently updated "Orwell Dev-C++" -- I still don't really recommend it, but it has at least had more recent bug fixes and has a significantly newer compiler/debugger/etc.


This is a fast moving field where new software and technologies are released all the time.  You certainly don't need to jump on to every new thing as it comes out -- and I would actually recommend waiting for a while and updating between projects! -- but if you want to remain relevant and produce good products you do need to make some effort to stay at least reasonably current.  Definitely, don't start any future projects using such an outdated choice of software without some very good reason!

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

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Similar Content

    • By lyth
      Hi i am a c++ programmer,
      Want to make games for mobile with c++ and compile it to android and ios.

      1- Is c++ with ((game library) or (game engine)) enough to make(compile, deploy ) games for mobile?
      or i have to  use c++ with (game library or game engine) with android studio ,ndk
      and , c++ with (game library or game engine) and Xcode , iOS SDK?
      2- What is next after learning c++ to be a gamer developer?
      3- And Some advices please.
    • By Josheir
      void update() { if (thrust) { dx += cos(angle*DEGTORAD)*.02; dy += sin(angle*DEGTORAD)*.02; } else { dx*=0.99; dy*=0.99; } int maxSpeed = 15; float speed = sqrt(dx*dx+dy*dy); if (speed>maxSpeed) { dx *= maxSpeed/speed; dy *= maxSpeed/speed; } x+=dx; y+=dy; . . . } In the above code, why is maxSpeed being divided by the speed variable.  I'm stumped.
      Thank you,
    • By Benjamin Shefte
      Hey there,  I have this old code im trying to compile using GCC and am running into a few issues..
      im trying to figure out how to convert these functions to gcc
      static __int64 MyQueryPerformanceFrequency() { static __int64 aFreq = 0; if(aFreq!=0) return aFreq; LARGE_INTEGER s1, e1, f1; __int64 s2, e2, f2; QueryPerformanceCounter(&s1); s2 = MyQueryPerformanceCounter(); Sleep(50); e2 = MyQueryPerformanceCounter(); QueryPerformanceCounter(&e1); QueryPerformanceFrequency(&f1); double aTime = (double)(e1.QuadPart - s1.QuadPart)/f1.QuadPart; f2 = (e2 - s2)/aTime; aFreq = f2; return aFreq; } void PerfTimer::GlobalStart(const char *theName) { gPerfTimerStarted = true; gPerfTotalTime = 0; gPerfTimerStartCount = 0; gPerfElapsedTime = 0; LARGE_INTEGER anInt; QueryPerformanceCounter(&anInt); gPerfResetTick = anInt.QuadPart; } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// void PerfTimer::GlobalStop(const char *theName) { LARGE_INTEGER anInt; QueryPerformanceCounter(&anInt); LARGE_INTEGER aFreq; QueryPerformanceFrequency(&aFreq); gPerfElapsedTime = (double)(anInt.QuadPart - gPerfResetTick)/aFreq.QuadPart*1000.0; gPerfTimerStarted = false; }  
      I also tried converting this function (original function is the first function below and my converted for gcc function is under that) is this correct?:
      #if defined(WIN32) static __int64 MyQueryPerformanceCounter() { // LARGE_INTEGER anInt; // QueryPerformanceCounter(&anInt); // return anInt.QuadPart; #if defined(WIN32) unsigned long x,y; _asm { rdtsc mov x, eax mov y, edx } __int64 result = y; result<<=32; result|=x; return result; } #else static __int64 MyQueryPerformanceCounter() { struct timeval t1, t2; double elapsedTime; // start timer gettimeofday(&t1, NULL); Sleep(50); // stop timer gettimeofday(&t2, NULL); // compute and print the elapsed time in millisec elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000.0; // sec to ms elapsedTime += (t2.tv_usec - t1.tv_usec) / 1000.0; // us to ms return elapsedTime; } #endif Any help would be appreciated, Thank you!
    • By mister345
      Hi, I'm building a game engine using DirectX11 in c++.
      I need a basic physics engine to handle collisions and motion, and no time to write my own.
      What is the easiest solution for this? Bullet and PhysX both seem too complicated and would still require writing my own wrapper classes, it seems. 
      I found this thing called PAL - physics abstraction layer that can support bullet, physx, etc, but it's so old and no info on how to download or install it.
      The simpler the better. Please let me know, thanks!
    • By lawnjelly
      It comes that time again when I try and get my PC build working on Android via Android Studio. All was going swimmingly, it ran in the emulator fine, but on my first actual test device (Google Nexus 7 2012 tablet (32 bit ARM Cortex-A9, ARM v7A architecture)) I was getting a 'SIGBUS illegal alignment' crash.
      My little research has indicated that while x86 is fine with loading 16 / 32 / 64 bit values from any byte address in memory, the earlier ARM chips may need data to be aligned to the data size. This isn't a massive problem, and I see the reason for it (probably faster, like SIMD aligned loads, and simpler for the CPU). I probably have quite a few of these, particular in my own byte packed file formats. I can adjust the exporter / formats so that they are using the required alignment.
      Just to confirm, if anyone knows this, is it all 16 / 32 / 64 bit accesses that need to be data size aligned on early android devices? Or e.g. just 64 bit size access? 
      And is there any easy way to get the compiler to spit out some kind of useful information as to the alignment of each member of a struct / class, so I can quickly pin down the culprits?
      The ARM docs (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html) suggest another alternative is using a __packed qualifier. Anyone used this, is this practical?
  • Popular Now