Getting Compatibility of bits

I remember having a hard time fighting 64 and 32 bit issues while testing emgu.CV last month. Final conclusion was to recompile OpenCV for 64-bits and then we had class tests and T2 where this issue finally lost interest.
Well, it came up again today, when Harsha sent a compiled example from emgu.CV for test on Vista 64 bit. Ooops, 'This program has stopped working'. I tried getting the sample working on my system, but no success at all - frustation.
Google said many more are frustated like you :). And finally an article on Bytes opened my eyes into a simple oneliner -
Well, the Express Edition of Visual Studio 2008 doesn't let you choose the target platform for your build. What I mean here is that if you're on a 64 bit machine with Vista-64, you won't be finding any drop-down in Project Properties to help you change the target.
Jon Skeet [C# MVP] has an interesting solution:
In your .csproj file, just make somechanges as shown
<PlatformTargetelement >
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
>
That's all! for my version of VS2008 Express things look like this after the change-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

Just below that, you've the configuration for Release version, add the PlatformTarget tag there too.


So, we would be maintaing all the modules of SpaceLock with x86 as target for now. Since the emgu & OpenCV binaries we have are in 32 bit, it would be wise and quicky to do this.

0 comments:

Post a Comment