Reputation: 189
I just started using QT. Right now I need to transfer some code I have on a Visual C++ project to QT.
The only thing the project does at the moment is open photoshop and set the visible flag to false (it will be used for automation, so a lot of things will be added later).
What I do is, I import 2 photoshop dlls (NOTE: I don't have .h or .lib for them, just the .dll files) The method I'm using to import these dlls is through import libid, since all the other methods I tried didn't work. They are COM objects, btw.
This is my VC++ code:
//library ID of Photoshop.dll
#import "libid:E891EE9A-D0AE-4cb4-8871-F92C0109F18E"
//library ID of PhotoshopTypeLibrary.dll
#import "libid:4B0AB3E1-80F1-11CF-86B4-444553540000"
int main()
{
Photoshop::_ApplicationPtr app( __uuidof(Photoshop::Application));
app->Visible = false;
return 0;
}
Now, I'm using the QT Creator with MinGW to compile this code, and it gives me some warnings and errors on the import lines:
warning: #import is a deprecated GCC extension
error: libid:E891EE9A-D0AE-4cb4-8871-F92C0109F18E: No such file or directory
And then, after that, it says (obviously) that "Photoshop" is not declared.
Now, I searched and the closest solution I found was to include the .tlh files that were created on my VC++ project, but when I did that, I got more than 1 thousand errors and warnings, so that obviously didn't work.
Can someone please tell me what to do here? I'm seriously stuck!
Upvotes: 1
Views: 3110
Reputation: 9817
#import
is a Microsoft extension that you can use to import COM libraries in VisualC++.
From your question it looks as if you have access to VisualC++ but that your QT code is compiled with gcc.
If you create a simple project in VisualC++ you can add the #import code and compile it. You will find that the compiler has generated a .tlh and .tli file. These files contain all the information that you need to use the COM library and can be used by any compiler.
You can then copy these files to your gcc project directory and use #include (not #import) on these generated files.
The .tlh is equaivalent of a c++ header, the .tli is more like a .cpp file.
Upvotes: 1