Professional OPC
Development Tools


Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

C++ without visual studio

28 Mar 2012 12:26 #815 by support
let's do as you wrote. I just need to ask you for some patience, as this is a bit bigger task than a usual tech support. So, I need to reserve some extra time. With this, I think it is safe to assume that my first results will be available in a week or less.

Please Log in or Create an account to join the conversation.

26 Mar 2012 16:23 #814 by neal
Replied by neal on topic Re: C++ without visual studio
In short, this sounds great! I think that you hit the nail on the head with your comment about how your example "calls it using all kinds of Microsoft-specific stuff such as the use of #import for creation of the C++ type wrappers from the type library, and the use of ATL classes " . Specifically, I believe that the ATL classes are why I was unable to get your examples to compile using Microsfot Visual C++ Express (

If you are willing to re-write a basic example of how to use your QuickOPC-COM library using only "standard" C++, I can test it with a couple of different compilers on my end. If (when!) I get past this initial learning curve, I will be happy to post a write up of what I have learned in case you have any other customers who are interested in doing something similar.

I had not come across the VOLE library yet, so thank you for that tip.

Please Log in or Create an account to join the conversation.

25 Mar 2012 05:05 #813 by support
thank you for clarification - I now understand better what you are trying to achieve.
We do not really have sufficient experience here with gcc or other tools you are using. I think that what we can do is that we will together develop a standards-based code that will on our side run under Microsoft C++, and at the same time you will help with making it compile and run under the tool that you choose. To give you an idea, below is an example that comes installed with QuickOPC-COM. The example demonstrates the basic use of QuickOPC-COM, but calls it using all kinds of Microsoft-specific stuff (such as the use of #import for creation of the C++ type wrappers from the type library, and the use of ATL classes CComVariant and CSafeArray to simplify the handling of OLE Automation variants and safe arrays).

// ReadMultipleItems.cpp : Defines the entry point for the console application.

#include "stdafx.h"

#import "libid:FAB7A1E3-3B79-4292-9C3A-DF39A6F65EC1" version(5.1) // EasyOpcLib
using namespace EasyOpcLib;

int _tmain(int argc, _TCHAR* argv[])
// Initialize the COM library

// Instatiate the EasyOPC-DA client object
IEasyDAClientPtr EasyDAClientPtr(__uuidof(EasyDAClient));

CComSafeArray ItemIdArray(4);
ItemIdArray[0] = _T("Simulation.Random");
ItemIdArray[1] = _T("Trends.Ramp (1 min)");
ItemIdArray[2] = _T("Trends.Sine (1 min)");
ItemIdArray[3] = _T("Simulation.Register_I4");

CComVariant vMissing;
vMissing.vt = VT_ERROR;

CComVariant vResults(EasyDAClientPtr->ReadMultipleItems(_T(""), _T("OPCLabs.KitServer.2"),
CComVariant(ItemIdArray.Detach()), vMissing));

CComSafeArray ResultArray(vResults.parray);
for (int i = ResultArray.GetLowerBound(0); i < ResultArray.GetUpperBound(0); i++)
IDAVtqResultPtr DAVtqResultPtr(ResultArray);
IDAVtqPtr DAVtqPtr(DAVtqResultPtr->Vtq);
_tprintf(_T("results(%d).Vtq.ToString(): %s\n"), i, DAVtqPtr->ToString().bstrVal);

// Release all interface pointers BEFORE calling CoUninitialize()
EasyDAClientPtr = NULL;


TCHAR line[80];
_putts(_T("Press Enter to continue..."));
_fgetts(line, sizeof(line), stdin);
return 0;

What I suggest is that we rewrite this code (or similar) so that it uses only "standard" C++ and works both under Microsoft C++ and your tool. I have looked around to see if there is a library that can make it easier, and have found just one, called VOLE:$...
<a href="" target="_blank" rel="nofollow">

with some examples:

Essentialy we would be doing the same as the examples do, except that we will call QuickOPC methods instead of methods of the MS Word or XML validator.
I cannot tell upfront if this is the viable way to go, but it is the (only) one that occurred to me. Please let me know how all this sounds to you.

Please Log in or Create an account to join the conversation.

23 Mar 2012 16:48 #810 by neal
Replied by neal on topic Re: C++ without visual studio
Thanks for your reply. To clarify what I am trying to do, I only need to connect to a single "classic" OPC-DA server and will be running on windows xp. I realize that the OPC interface will be windows specific; I am just trying to keep the rest of my software as "standard" ANSI C++ as possible (hence, staying away from Visual Studio) to keep my options open for porting to Linux / OPC-UA (with a different opc client library) at some point in the (likely distant) future.
So, for what I am doing now, the QuickOPC-COM library seems like it could be a good solution for me and I would like to try it. However, I've not used COM components before and my initial attempts over the last few days have not gone well. Can you (or anyone else out there) point me towards some basic examples or other helpful documentation?

Please Log in or Create an account to join the conversation.

23 Mar 2012 09:17 #809 by support
QuickOPC-COM is a Microsoft COM component itself, and therefore it should be consumable from any language and tool that supports using COM components. Since COM, however complex, is just a Windows API, and about the only thing that is truly required to use it is the ability to call Win32 functions and work with function pointers (vtables), it should work with any C or C++ compiler (on Windows only).
This said, the code that needs to be written may be somewhat ugly, but that's mainly for plain C. In C++, consuming COM objects is usually translated to calling methods on "normal" C++ objects. This is done by frameworks or libraries (such as ATL for MFC in Microsoft compilers). I believe that similar frameworks/libraries exist for gcc or Borland as well. Currently, we have no examples or more information about how to do this. If you want to pursue this scenario, let me know and I will be willing to work with you on figuring out the right way to do it.
OPC-UA is, from our point of view, a different story. For your needs, there is an ANSI C stack built by OPC Foundation itself (available in source to members). Using that one would be the most appropriate, "native" way to write a portable software that supports OPC-UA. Compared to QuickOPC, the API of the stack (or SDK) itself is quite complex. We, as a company, currently only focus on Windows, and therefore our QuickOPC-UA product does not use this stack, but instead it is based on .NET stack.
The bottom line is that I think that QuickOPC-COM can be a solution for you for connecting to OPC "classic" (COM-based) servers under Windows, even with non-Microsoft compilers. But we do not have such solution for OPC-UA, or any solution portable outside of Windows platform.
Best regards

Please Log in or Create an account to join the conversation.

22 Mar 2012 20:18 #808 by neal
I am trying to find a simple OPC Client library that will work with a standard C++ compiler (i.e. not MS Visual C++). My needs from the OPC Client are pretty simplisitc, but I am trying to keep as much of my code as possible vanilla ANSI C++ for future portability (hopefully to OPC-UA running on Linux). I am developing and running on windows xp for now.
Will QuickOPC work with gcc (mingw) or the borland c++ compiler (ideally not the full-blown borland c++ builder)? Can someone point me towards some examples of how to set this up?
Thanks for any help or advice you can give!

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.057 seconds