Trouble with linking

Hey all,
I'm trying to write some C++ code for windows 7 which will connect to a mobile broadband network. When I run the first example at http://msdn.microsoft.com/en-us/library/ee677092(v=VS.85).aspx I get the following when compiling within visual studio:

1>testII.obj : error LNK2001: unresolved external symbol _CLSID_MbnInterfaceManager
1>testII.obj : error LNK2001: unresolved external symbol _IID_IMbnInterfaceManager

or when I compile with the "cl" command at the command prompt I get:

test.cpp
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.exe
test.obj
test.obj : error LNK2019: unresolved external symbol _CLSID_MbnInterfaceManager referenced in function _main
test.obj : error LNK2019: unresolved external symbol _IID_IMbnInterfaceManager referenced in function _main
test.exe : fatal error LNK1120: 2 unresolved externals


It would seem I need to link so some library somewhere, can anyone tell me which library and how to link it? Do these errors have anything to do with the mbnapi.idl requirement?

Thanks a lot, appreciate it
Last edited on
What header are you including that defines those functions? Generally the headers and the libraries are names similarly.
The only headers are:

#include <atlbase.h>
#include "mbnapi.h"
Just had a thought, I was looking at compiling mbnapi.idl separately earlier, this produced several files, one of which was mbnapi.tlb I believe, perhaps this is the library file I need to include, though I haven't seen the extension before, I try including that.
..........Still can't figure this out, I don't think the errors have anything to do with not linking to some library, it may have to do with the tlb file, but how do you include such a file in your project? I guess the problem is I don't understand IDL, how does one satisfy the IDL requirement specified on http://msdn.microsoft.com/en-us/library/ee677092(v=VS.85).aspx , the mbnapi.idl requirement. The file is there, everything compiles, it just seems to have troubles linking. I see forum posts on how to register the tlb files produces when compiling the idl files but I would think that wouldn't be necessary here since mbnapi.idl is a windows file, not something I created. Can anyone please explain, or point me to the proper resources??

Thanks
Last edited on
I think you have to link against some source file(s) contained with the project... like "cl <options here> test.cpp mbnapi.cpp <options here>"

I don't know that linker so I couldn't say how to do it....

In g++ the command would be:
g++ -O3 -Wall test.cpp mbnapi.cpp -o Test.exe

and it would link those files together and compile into Test.exe.

These kinda errors happen to me when I don't link against other src files that are referred to in the main src.
Last edited on
Thanks for the suggestions Ryan, though there is no mbnapi.cpp , mbnapi holds the windows API stuff for mobile broadband, it comes in a IDL (Interface Description Language) file, mbnapi.idl. When compiling mbnapi.idl with the proper compiler, midl, it produces:
mbnapi.h
mbnapi.tlb
mbnapi_i.c
mbnapi_p.c
I know that tlb stands for type library, perhaps I need to include this somehow? Thing is, its a binary specification and I can' figure out how to (or if I should) include it. The top of the example at http://msdn.microsoft.com/en-us/library/ee677092(v=VS.85).aspx uses the line #include "mbnapi.h" with single quotes, not sure why this works, its not a file in the project directory... Can anyone explain how to integrate and IDL requirement into a visual studio project, or if thats even what I need to do to solve the linking issues??

Thank you

Solved it! What you need to do is include mbnapi_uuid.lib, thanks again for the tips Zhuge and Ryan.
Topic archived. No new replies allowed.