Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Build on Windows using MS Visual C++ 2008 pro
06-02-2013, 04:04 PM
Post: #1
Build on Windows using MS Visual C++ 2008 pro
Hello,

I've been trying to build ohNet on a Win 7 machine with Visual C++ 2008 pro. The README file seems to indicate that version earlier than 2010 are fine (modulo a couple of adjustments).

I encountered the following errors :

Code:
cl /nologo /FoBuild\Obj\Windows\Release\MdnsPlatform.obj -c /MT /Ox /W4 /EHsc /FRBuild\Obj\Windows\Release\ -DDEFINE_LITTLE_ENDIAN -DDEFINE_TRACE -D_CRT_SECURE_NO_WARNINGS -IBuild\Include OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp
MdnsPlatform.cpp
OpenHome/Net/Device/Bonjour/MdnsPlatform.cpp(323) : error C2039: 'at' : is not a member of 'std::map<_Kty,_Ty>'
        with
        [
            _Kty=OpenHome::TUint,
            _Ty=ServiceRecordSet *
        ]
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code
'0x2'
Stop.

It appears that part of the code is using a the method at() on std::map, which is C++11, if I'm not mistaken.

Is anyone aware of this issue, or able to confirm that VC9 isn't supported?

Many thanks in advance,
A.
Find all posts by this user
06-02-2013, 04:21 PM
Post: #2
RE: Build on Windows using MS Visual C++ 2008 pro
(06-02-2013 04:04 PM)Attrition Wrote:  Hello,

I've been trying to build ohNet on a Win 7 machine with Visual C++ 2008 pro. The README file seems to indicate that version earlier than 2010 are fine (modulo a couple of adjustments).

[snip]

It appears that part of the code is using a the method at() on std::map, which is C++11, if I'm not mistaken.

Is anyone aware of this issue, or able to confirm that VC9 isn't supported?

Thanks for the detailed report! Introducing C++11 dependencies certainly wasn't deliberate; we were just missing a sufficiently old stl in our suite of regular builds. I'll replace the use of std::map::at with ::operator [] instead.

Would you mind checking that there aren't other, similar lurking issues by applying the following patch and building again?

Code:
@@ -320,7 +320,7 @@ void MdnsPlatform::RegisterService(TUint aHandle, const TCha
void MdnsPlatform::RenameAndReregisterService(TUint aHandle, const TChar* aName
{
     LOG(kBonjour, "Bonjour             RenameService\n");
-    ServiceRecordSet* service = iServices.at(aHandle);
+    ServiceRecordSet* service = iServices[aHandle];
     domainlabel name;
     SetDomainLabel(name, aName);
     mDNS_RenameAndReregisterService(iMdns, service, &name);
Find all posts by this user
06-02-2013, 05:09 PM
Post: #3
RE: Build on Windows using MS Visual C++ 2008 pro
Many thanks for the prompt answer! I can confirm that was the only one.

Now I'm hitting another error though :

Code:
Creating library Build\Obj\Windows\Release\ohNet.lib and object Build\Obj\Windows\Release\ohNet.exp
        csc /nologo /platform:x86 /unsafe /t:library /optimize+  /warnaserror+ /out:Build\Obj\Windows\Release\ohNet.net.dll  OpenHome\Net\Bindings\Cs\ControlPoint\CpDevice.cs  OpenHome\Net\Bindings\Cs\ControlPoint\CpDeviceUpnp.cs  OpenHome\Net\Bindings\Cs\ControlPoint\CpProxy.cs  OpenHome\Net\Bindings\Cs\ControlPoint\CpService.cs  OpenHome\Net\Bindings\Cs\Device\DvDevice.cs  OpenHome\Net\Bindings\Cs\Device\DvProvider.cs  OpenHome\Net\Bindings\Cs\Device\DvProviderErrors.cs  OpenHome\Net\Bindings\Cs\Device\DvServerUpnp.cs  OpenHome\Net\Bindings\Cs\Service.cs  OpenHome\Net\Bindings\Cs\OhNet.cs  OpenHome\Net\Bindings\Cs\SubnetList.cs  OpenHome\Net\Bindings\Cs\ControlPoint\CpDeviceDv.cs
OpenHome\Net\Bindings\Cs\Service.cs(49,64): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(49,96): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(49,124): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(76,66): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(76,86): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(76,114): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(307,78): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(383,80): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(459,80): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(543,84): error CS0241: Default parameter specifiers are not permitted
OpenHome\Net\Bindings\Cs\Service.cs(632,84): error CS0241: Default parameter specifiers are not permitted
NMAKE : fatal error U1077: 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.EXE' : return code '0x1'
Stop.

It appears that default parameter specifiers are permitted starting .NET 4.0. When using an anterior version of .NET, the compilation fails.

A.
Find all posts by this user
06-02-2013, 05:23 PM (This post was last modified: 06-02-2013 05:23 PM by simonc.)
Post: #4
RE: Build on Windows using MS Visual C++ 2008 pro
(06-02-2013 05:09 PM)Attrition Wrote:  Many thanks for the prompt answer! I can confirm that was the only one.

Now I'm hitting another error though :


It appears that default parameter specifiers are permitted starting .NET 4.0. When using an anterior version of .NET, the compilation fails.

A fair bit of our code depends on .NET v4 APIs and features. I wouldn't be keen on downgrading this.

Is there any way you can move to a more recent version of Visual Studio? VS2012 Express is free and has all the features that previously convinced me to use the Pro versions.
Find all posts by this user
06-02-2013, 05:43 PM
Post: #5
RE: Build on Windows using MS Visual C++ 2008 pro
(06-02-2013 05:23 PM)simonc Wrote:  A fair bit of our code depends on .NET v4 APIs and features. I wouldn't be keen on downgrading this.

Is there any way you can move to a more recent version of Visual Studio? VS2012 Express is free and has all the features that previously convinced me to use the Pro versions.

I'm looking into ohNet as a potential UPnP stack candidate for integration in our various code bases (Windows, MacOS, iOS, Android). Unfortunately our product on the Windows platform is compiled with Visual C++ 2008, and changing the compiler has ramifications greater than I'd wish.
Find all posts by this user
06-02-2013, 07:32 PM
Post: #6
RE: Build on Windows using MS Visual C++ 2008 pro
(06-02-2013 05:43 PM)Attrition Wrote:  I'm looking into ohNet as a potential UPnP stack candidate for integration in our various code bases (Windows, MacOS, iOS, Android). Unfortunately our product on the Windows platform is compiled with Visual C++ 2008, and changing the compiler has ramifications greater than I'd wish.

I understand. Thinking about it more, we may make greater use of .NET 4.0 features in other projects. If you wanted to have a go at making ohNet's bindings compile as v3.5, I'd be happy to integrate any reasonable patch.
Find all posts by this user
07-02-2013, 09:20 AM
Post: #7
RE: Build on Windows using MS Visual C++ 2008 pro
I'd agree with Simon - while I think some of our other projects make significant use of .NET 4.0 features, I don't believe that's the case for ohNet. In fact, while I really like a lot of .NET 4.0 features, I'm actually a bit lukewarm on default arguments, at least when used in a public API. This is largely because of the surprising way they are baked in to the *caller's* assembly during compilation. It makes sense when you understand the underlying mechanism (in that they are purely a compiler feature, not a CLR feature), but I could imagine scenarios where it would catch you by surprise.

My point, if I have one, is that I too would be happy if somebody wanted to make the ohNet C# bindings .NET 3.5 compatible, and I'm cautiously optimistic that it might not be too hard.
Visit this user's website Find all posts by this user
07-02-2013, 10:05 AM
Post: #8
RE: Build on Windows using MS Visual C++ 2008 pro
I would love to contribute, unfortunately I can't spend time on that right now. However, if my team was to decide to use ohNet for our project, it is likely we'd look into it seriously.

In any case, I'd suggest an update of the README file. The "Prerequisites" section still mentions the Microsoft .NET 3.5 SDK as optional.
Find all posts by this user
19-02-2013, 02:12 PM
Post: #9
RE: Build on Windows using MS Visual C++ 2008 pro
(07-02-2013 10:05 AM)Attrition Wrote:  In any case, I'd suggest an update of the README file. The "Prerequisites" section still mentions the Microsoft .NET 3.5 SDK as optional.

Good point. Now (belatedly) fixed.
Find all posts by this user


Forum Jump: