Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Generated Proxies | Linker Error "is aleady defined"
04-01-2015, 09:45 PM (This post was last modified: 04-01-2015 10:32 PM by ChriD.)
Post: #1
[Solved] Generated Proxies | Linker Error "is aleady defined"
Hi,

I created a standard ControlPoint AvTransport service proxy using ohGen for CPP.

Now if i want to use this generated proxy, the linker (MSVC2013) throws errors that there are severall symbols which are already defined.
(I don't know if gcc throws up same errors. I Didn't try it until now)

The class provided in the proxy is not used. I only added the 2 files (header and cpp) to my project and did a build.

Exapmle:
Code:
error LNK2005: ... OpenHome::autoMutex(void) is already defined (ohNet.lib)


I'm aware of this error but i cant find/fix the reason.
I found some "precreated" proxy files for CPP on Git. Same Linker problem...

those libs are linked to the project
Code:
ohNet.lib
ohNetCore.lib
ohNetProxies.lib
ohNetDevices.lib

So of course in ohNetCore.lib there are some objects which will be redefined/declared using the proxy...
because of those includes in the proxy cpp file?

Code:
...
#include <OpenHome/Net/Core/FunctorAsync.h>
#include <OpenHome/Net/Core/CpProxy.h>
...


How can i solve this?
What am i doeing wrong? Sad
Find all posts by this user
04-01-2015, 10:27 PM
Post: #2
RE: Generated Proxies | Linker Error "is aleady defined"
You should only link against one of ohNet.lib or ohNetCore.lib

ohNet.lib is a link library that defines the symbols available when calling into ohNet.dll

ohNetCore.lib is a static library that contains all of the functionality from ohNet.dll. The linker will embed this functionality into your application, giving you a bigger executable but removing the need to bundle a separate dll.

You can use either one of these but cannot use both.
Find all posts by this user
04-01-2015, 10:31 PM
Post: #3
RE: Generated Proxies | Linker Error "is aleady defined"
Ohhhhh... Well that solved the problem Confused
I didn't notice that the one is the static lib and the other the import lib!

Thank you very much Exclamation
Find all posts by this user


Forum Jump: