Thread: What is a good complier?

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    45

    What is a good complier?

    I am using Microsoft Visual Studio 2010 Professional and my program complies correctly and runs correctly. However my teacher is using the 2008 version and I need to check if my source will compile and run correctly on 2008 as well.

    I need a good compiler that will compile my source like the 2008 version but without downloading the whole program. Is this possible?

    The reason I am doing this is because I got a zero on my last project. Apparently the program complies and runs correctly on my computer with the 2010 version but gives the teacher an error on the 2008 version.

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    both compilers are compliant (mostly) with the international C++ standard, and if it compiles with 2010, it will certainly work with 2008, as long as it doesn't make use of any features of the new, as yet unpublished, language standard.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    If you want a guarantee that your code will compile with your teacher's compiler, use the same compiler.

    While there are differences between compilers and compiler versions, the most likely reason your code works with one compiler and not with another is that you are using bad techniques (for example, compiler specific extensions) or techniques. If you are trying to be overly smart, and use features that are in draft standards, stop doing so.

    Given that Visual Studio is an IDE, it is also possible you are relying on particular IDE features and settings. Try submitting the source and header files that you write, rather than the whole project.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #4
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    EDIT: Oh, this is C++. My second paragraph already covered. So assume this as a deleted post
    Last edited by C_ntua; 04-16-2011 at 02:32 PM.

  5. #5
    C++ Junkie Mozza314's Avatar
    Join Date
    Jan 2011
    Location
    Australia
    Posts
    174
    The reason I am doing this is because I got a zero on my last project. Apparently the program complies and runs correctly on my computer with the 2010 version but gives the teacher an error on the 2008 version.
    Lecturers can be pretty insensitive about that. Probably a tiny error they could have fixed in a few seconds but instead they thought "woohoo this assignment is uber easy to mark".

    Anyway, using multiple compilers is a really good idea. It'll help you write better, more standard code. As an added bonus, if you get a really weird error message you can try the other compiler and the error might make more sense. I recommend you take a look at mingw, the windows port of gcc.

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I have used both 2008 and 2010 interchangeably and have found very few instances where code in 2008 would not run in 2010 but that is b/c I have BOTH of them installed. However, to ensure your code runs on your prof's system you can create a setup and deployment project that will create a setup program that will copy the correct runtimes. There are differences in how 2008 and 2010 link to the runtimes. After MSVS 2003 Microsoft started the side-by-side linker mess that caused a lot of issues with code when moving from 2003 to 2005. It seems now they have once again altered the linking to work a bit more like it did in 2003. I would imagine the problem with your code on your prof's system is it is trying to link with the runtime in <windows>/System/WinSxS/<runtime_folder>. The manifest for your exe will show you the runtime path. If that path does not exist on the target system then the code will not run correctly and you will get a side-by-side error. This error will be logged in the event viewer under application errors. To fix this you must copy the 2008 runtimes into the correct WinSxS folder (the one specified in the manifest) or create a setup and deployment project which will detect the dependency and do it for you.

    I cannot imagine any professor assuming that a different compiler will run your code. The prof and students should be on the same version of compiler. It is very rare for one half of a development team to use one version of a compiler and the other half to use another. If this is ever the case these differences must be sorted out before any development begins or both teams will end up chasing their tails simply due to linking errors caused by compiler version differences. Now if your assignment was designed to specifically address this problem then you did not do adequate enough research on it to fulfill the requirements of the assignment.
    Last edited by VirtualAce; 04-17-2011 at 01:11 PM.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    right click on your project in the project explorer and click properties
    then go to configuration properties -> General -> Platform Toolset and see if you can change it from v100 to v90

    this should make it compile as if it were being built on 2008.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. About the complier
    By wdliming in forum C Programming
    Replies: 6
    Last Post: 10-16-2010, 09:32 PM
  2. C++ Complier
    By ebonie10 in forum C++ Programming
    Replies: 5
    Last Post: 09-17-2010, 01:40 PM
  3. C # complier
    By obaid in forum C# Programming
    Replies: 2
    Last Post: 02-17-2008, 03:23 PM
  4. complier
    By yeah in forum C Programming
    Replies: 3
    Last Post: 02-12-2005, 01:31 AM
  5. New to C help with complier
    By iaNb in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 01-10-2002, 11:53 AM