Menu

Dev-C++ Code does not work in other compilers

pirates712
2011-10-26
2012-09-26
  • pirates712

    pirates712 - 2011-10-26

    Hi,

    I'm using Dev-C++ version 4.9.9.2 on Windows 7 64 bit for an intro to C++
    class. The "problem" is, I can write code in Dev that compiles and runs
    perfectly, but doesn't compile in Microsoft Visual Studio or g++. For example,
    I forgot the #include <string> in one homework problem and it compiled and ran
    perfectly, but I got very little credit for it because it didn't work in
    Visual Studio or g++. Dev also seems to be automatically setting variables
    equal to zero, which visual studio doesn't like either.

    I looked through the faq's and didn't see anything that answered my question.
    Any help would be appreciated.

     
  • Jim Pattee

    Jim Pattee - 2011-10-26

    Dev-Cpp uses the mingw compiler which is causing the problem.

    It is not unusual for a program to have errors when you change compilers. You
    should compile it with the compiler your class uses to be sure it works. Mingw
    will automatically include headers if it can determine they are needed. Other
    compilers may not. The variables being set to zero is probably a coincidence.
    It depends what was in memory when the program was compiled.

    The problems caused by changing compilers are usually minor and can be easily
    fixed. Developing with mingw is OK. But you need to compile and run it on the
    compiler used by your class. Many open source programs are compiled with
    several compilers to be sure they are error free.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.