0

I'm using Code::Blocks to develop a C application in Windows. When I build the application it builds and runs as expected. When my colleague builds the application it builds but doesn't behave correctly when it runs. The exe files created are also different sizes. The Code::Blocks project is stored in subversion and is as far as we can tell the same for both of us.

Can anyone suggest what could be causing the differences?

4
  • 3
    What do you mean by "doesn't behave correctly"? Commented Feb 28, 2012 at 17:13
  • 1
    Plus, if you make a simple as possible app, does the problem persists? Do you rely on any libraries (static or DLL) that might differ between systems? Commented Feb 28, 2012 at 17:32
  • The two applications function differently on the two machines. It is a simple command line app that uses some static libs. As far as I can tell they are the same on both machines. Commented Feb 28, 2012 at 17:37
  • 1
    "functions differently" how? Details are what we need. What is it supposed to do? What does it do instead? Commented Feb 28, 2012 at 17:42

1 Answer 1

1

To summarize:

  • identical project file and sources checked out from svn
  • identical libraries as far as you can tell
  • presumably same compiler used
  • differently sized executables
  • different program behaviour

A different compiler, even a different version, could explain differently sized programs but not different behaviour, unless there is a serious compiler bug, which is extremely unlikely. You can ask the compiler for its version to be 100% sure, however (if you use the GNU compiler, try e.g. gcc --version)

Different versions of static libraries could similarly explain differently sized program sizes, but should normally not result in incorrect behaviour. To turn the "as far as I can tell" into certainity, you and your collegue should either both do a clean install of these libs (from the same aggreed version), or compare checksums (such as md5sum).

If you can safely rule out the possibility of malware on your collegue's computer (this could very well explain both symptoms!), the likely reason for the combination of "differently sized program and different/wrong behaviour" is that one of you has some optimization options enabled or compiles a different laguage standard, and at the same time, the source contains code that is not allowed by the standard (but tolerated, maybe with a warning) or triggers undefined behaviour.

Always compile at least with -Wall -Wtraditional and fix anything the compiler complains about, even if you think it's silly. Always. This prevents 99% of all "behaves strangely sometimes" kind of errors. Really, compiler warnings are not an annoyance, they are a help.

Note that having different build options in two different places can happen, even if it's not immediately obvious. First, the project file could have been locally changed and not committed. As long as no conflicting version is committed on the other side, you will never see as much as a warning from Subversion. Second, your collegue could have set some options globally in the compiler preferences. These will be applied to every project.

To rule out the possibility of different build settings, save the build log on each machine to a text file, and diff them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.