unresolved external symbol _vaoGetObject ??

S

Scott Metzger

Hi,

I am trying to create a .exe Automation client written in C++. I am
getting the following error:
VisioRead error LNK2019: unresolved external symbol _vaoGetObject
referenced in function "short __cdecl vaoGetObjectWrap(class
CVisioApplication &)" (?vaoGetObjectWrap@@YAFAAVCVisioApplication@@@Z)

Here is a code snippet:

#include "VisioRead.h"
#include "VisioReadDlg.h"
#include ".\visioreaddlg.h"
#include "vaddon.h"
#include "visiwrap.h"

void CVisioReadDlg::GetApp(CVisioApplication& vsoApp)
{
::OleInitialize(NULL);
CVisioApplication app;
vaoGetObjectWrap(app);
}

Any ideas?

Thanks,
Scott Metzger
 
S

Scott Metzger

Bill said:
To fix the error below, one way is to turn off the "use pre-compiled header"
option for the file ivisreg.cpp (under menu: Project > Properties).

Thanks that worked.
The Visio wizard for .net 2003 has not been released yet, but you can
download the PIA or find some good info for using managed code from here:
http://msdn.microsoft.com/library/default.asp?url=/nhp/default.asp?contentid=28000456

I am using unmanaged code so I don't think that will help me.

Visual Studio .Net 2003 will upgrade a project file from 6.0, is there a
way to have it upgrade a wizard?

Thanks,
Scott Metzger
 
S

Scott Metzger

Now I am getting the following error:

VisioRead error LNK2019: unresolved external symbol "public: __thiscall
VBstr::VBstr(void)" (??0VBstr@@QAE@XZ) referenced in function "public:
void __thiscall CVisioReadDlg::OnBnClickedButton1(void)"
(?OnBnClickedButton1@CVisioReadDlg@@QAEXXZ)


My code so far is:
#include <visiwrap.h>
void CVisioReadDlg::OnBnClickedOk()
{
::OleInitialize(NULL);
vaoGetObjectWrap(vsoApp);
}

void CVisioReadDlg::OnBnClickedButton1()
{
VBstr name_id;
}
 
B

Bill K. [MSFT]

Include helpers.cpp in your project.
There are several other files you may want as well. Take a look at this file
in the sdk for an example:
....\Visio10\sdk\samples\cpp\genericmfc\vao_all.cpp


Hope this helps,
 
S

Scott Metzger

Bill said:
Include helpers.cpp in your project.
There are several other files you may want as well. Take a look at this file
in the sdk for an example:
...\Visio10\sdk\samples\cpp\genericmfc\vao_all.cpp

Err... #include .cpp

Anyway, I tried
putting those #include .cpp in my project and got another unresolved
external.

I then removed the #include .cpp, and added the .cpp files explicetly to
my project (with the not using precompiled header set) and I get the
same error:

VisioRead error LNK2001: unresolved external symbol _gbl_hDLLModule

Any ideas?

Thanks,
Scott Metzger
 
S

Scott Metzger

Bill said:
Add vao.c to your project.

Now I get the following error:
VisioRead error LNK2005: "long __cdecl CoCreateAddonSinkForHandler(long
(__stdcall*)(struct IUnknown *,short,struct IDispatch *,long,long,struct
IDispatch *,struct tagVARIANT,struct tagVARIANT *),class VEventHandler
*,struct IUnknown * *)"
(?CoCreateAddonSinkForHandler@@YAJP6GJPAUIUnknown@@FPAUIDispatch@@JJ1UtagVARIANT@@PAU3@@ZPAVVEventHandler@@PAPAU1@@Z)
already defined in VisioRead.obj

I get the same error when using #include "Vao.c" and when I explicitly
add vao.c to my project.

Thanks,
Scott Metzger
 
S

Scott Metzger

Ok, now this is pretty weird behavior. My code now looks like this:
#include <visiwrap.h>
void CVisioReadDlg::OnBnClickedOk()
{
::OleInitialize(NULL);
CVisioApplication vsoApp;
vaoGetObjectWrap(vsoApp);
}

And then I added vao_all.cpp to my project, and instead of creating a
..exe I get a .lib file. How did that happen?

Thanks,
Scott Metzger
 
S

Scott Metzger

Ok, I got it to compile. Here is what needs to be done to create a .exe
using MSVC 7.0 (.net2003) and the visiwrap library for Visio 2002.

1) Add the following as a .cpp to your project:
#include "stdafx.h"
#include "VisioRead.h"
#include "addsink.cpp" // For hooking up to Visio events
#include "helpers.cpp" // BSTR and VARIANT helper classes
#include "ivisreg.cpp" // Getting/creating an Automation instance
#include "vaddon.cpp" // The "easy-to-subclass" VAddon

extern "C"
{
#include "vao.c" // .exe utility functions
}

#include "vexe.cpp"


2) #include "visiwrap.h" where you need to reference the visio stuff

3) Add VADDON_MFC;VADDON_EXE to your pre-processor

Thank You,
Scott Metzger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top