Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in OhNet Testing files
15-10-2014, 05:06 AM (This post was last modified: 15-10-2014 05:07 AM by rselvan.)
Post: #1
Error in OhNet Testing files
Hi,

I try to run ohnet testing files but it always show errors. I include ohnet library properly when i build testing file show follow errrors
Code:
error LNK2019: unresolved external symbol "public: char const * __thiscall OpenHome::Exception::Message(void)" (?Message@Exception@OpenHome@@QAEPBDXZ) referenced in function __catch$?Run@Runner@TestFramework@OpenHome@@QAEXXZ$0
1>sample.obj : error LNK2019: unresolved external symbol "public: char const * __thiscall OpenHome::Exception::File(void)" (?File@Exception@OpenHome@@QAEPBDXZ) referenced in function __catch$?Run@Runner@TestFramework@OpenHome@@QAEXXZ$0
1>sample.obj : error LNK2019: unresolved external symbol "public: unsigned int __thiscall OpenHome::Exception::Line(void)" (?Line@Exception@OpenHome@@QAEIXZ) referenced in function __catch$?Run@Runner@TestFramework@OpenHome@@QAEXXZ$0
Find all posts by this user
15-10-2014, 08:58 AM
Post: #2
RE: Error in OhNet Testing files
(15-10-2014 05:06 AM)rselvan Wrote:  I try to run ohnet testing files but it always show errors. I include ohnet library properly when i build testing file show follow errrors

Can you show the smallest possible example that demonstrates this problem please? I understand the errors you're getting but not the sort of program you've written to create them.

Alternatively, look at OhNet.mak and Common.mak - they include build commands for many test programs which link correctly so might help you spot the error in your project setup.
Find all posts by this user
15-10-2014, 10:21 AM
Post: #3
RE: Error in OhNet Testing files
Code:
#include <iostream>
#include <OpenHome/Net/Cpp/DvDevice.h>
#include <string>

using namespace std;
using namespace OpenHome;
using namespace OpenHome::Net;

int main() {

  
    InitialisationParams* init_params = InitialisationParams::Create();
    UpnpLibrary::Initialise(init_params);
    UpnpLibrary::StartDv();
    return 0;
}

This is the output for the above sample code

Code:
index.obj : error LNK2019: unresolved external symbol "public: static void __cdecl OpenHome::Net::UpnpLibrary::StartDv(void)" (?StartDv@UpnpLibrary@Net@OpenHome@@SAXXZ) referenced in function _main
1>index.obj : error LNK2019: unresolved external symbol "public: static class OpenHome::Environment * __cdecl OpenHome::Net::UpnpLibrary::Initialise(class OpenHome::Net::InitialisationParams *)" (?Initialise@UpnpLibrary@Net@OpenHome@@SAPAVEnvironment@3@PAVInitialisationParam​s@23@@Z) referenced in function _main
1>index.obj : error LNK2019: unresolved external symbol "public: static class OpenHome::Net::InitialisationParams * __cdecl OpenHome::Net::InitialisationParams::Create(void)" (?Create@InitialisationParams@Net@OpenHome@@SAPAV123@XZ) referenced in function _main
Find all posts by this user
15-10-2014, 10:25 AM
Post: #4
RE: Error in OhNet Testing files
Thanks. How do you build that code? The errors you posted are from the linker so the error is likely to be in your link command.

I'd guess that you're failing to pass ohNetCore.lib to the linker. It's also possible that you're trying to link against ohNet as a DLL (the previous example is a static library that'll be linked into your executable). If you post your full build command, the error will hopefully be obvious.
Find all posts by this user
15-10-2014, 11:09 AM
Post: #5
RE: Error in OhNet Testing files
Hi
Thanks for the quick response.

I've not started to build my actual project in this oHNet SDK.

I need to understand full functionality of sample code snippet. So that, i will be starting my project.
But, as of now, i can't even run the sample code successully.

Can you please suggest me what i'm doing wrong here?
Find all posts by this user
15-10-2014, 12:13 PM
Post: #6
RE: Error in OhNet Testing files
(15-10-2014 11:09 AM)rselvan Wrote:  Hi
Thanks for the quick response.

I've not started to build my actual project in this oHNet SDK.

I need to understand full functionality of sample code snippet. So that, i will be starting my project.
But, as of now, i can't even run the sample code successully.

Can you please suggest me what i'm doing wrong here?

You are building the code incorrectly here. Your program wants to consume functionality from ohNet so you need to tell the linker how to find your ohNet library. This can be done from the command line by passing the library name in a link command or can be done from a Visual Studio project by adding a reference to your ohNet library.

I don't mean to be rude, but this is pretty basic stuff. If you don't have experience in writing programs that use additional libraries, writing a UPnP control point is likely to be too difficult. I suggest you talk to your supervisor (or teacher) and ask for either an alternative task or much better support.
Find all posts by this user


Forum Jump: