Hello
I have a project using "OleLoadPicturePath"
built with PellesC 6.50 is OK
without modifying the project:
built with PellesC 7.00.02
I get the following error:
Polink: error: Unresolved external symbol 'IID_IPicture'.
Why?
Thank you for your answers
(ps: I am French, and not very good in English, this is a translation with Google)
Right click on the IID_Picture in your source code and go to it's definition... it may be a header change between versions, so you may need to include something new...
Also try adding
#define WIN32_DEFAULT_LIBS
to the top of each compilation unit (either in a common header or at the top of each page). If you want more information on this define, look in the Help file's Appendix, Pelle explains it there.
Are you linking with olepro32.dll ?
Also #include <olectl.h>
and at the top of your code
extern const IID IID_IPicture;
John
Hello CommonTater,
I did what you have called me:
put # define WIN32_DEFAULT_LIBS early
then included <ocidl.h>
but I still have the error.
Below is a snippet of the code
#define WIN32_DEFAULT_LIBS
#include <windows.h>
#include <olectl.h>
#include <ocidl.h>
// Variables globales:
char chemin[260];
LONG_PTR CALLBACK StaticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
WNDPROC OldStaticProc;
// Fonction d'affichage de l'image JPG:
void AfficheImage(char* path, HWND hwndcible)
{
// Variables:
IPicture* pic;
HRESULT hres;
HDC hdc;
RECT rect;
long hauteur, largeur;
// int hauteur, largeur;
WCHAR wpath[260];
// Convertir le chemin en UNICODE:
MultiByteToWideChar(0,0,path,-1,wpath,260);
// Ouverture de l'image:
hres = OleLoadPicturePath(wpath, 0,0, 0, &IID_IPicture, (void**)&pic);
// Obtenir le HDC du controle cible:
hdc=GetDC(hwndcible);
// Obtenir la zone cliente du controle cible:
GetClientRect(hwndcible,&rect);
// Obtenir la largeur et la hauteur de l'image:
hres=pic->lpVtbl->get_Width(pic,&largeur);
hres=pic->lpVtbl->get_Height(pic,&hauteur);
// Afficher l'image:
hres=pic->lpVtbl->Render(pic,hdc,0,0,rect.right,rect.bottom,0,hauteur,largeur,-hauteur,0);
// Libérer le HDC du controle cible:
ReleaseDC(hwndcible,hdc);
//Libérer l'interface IPicture:
pic->lpVtbl->Release(pic);
}
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//#include <ole2.h>
#include <olectl.h>
#pragma comment(lib, "ole32.lib")
#pragma comment(lib, "oleaut32.lib")
#pragma comment(lib, "uuid.lib")
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
HRESULT hr = CoInitialize(NULL);
LPWSTR pwszPath = L"image.jpg";
IPicture *gpPicture;
hr = OleLoadPicturePath(pwszPath, NULL, 0, 0, &IID_IPicture, (LPVOID *) & gpPicture);
CoUninitialize();
return 0;
}
This example build ok, so IID_IPicture is found.
Hi nomis... sorry that didn't solve your problem.
I'll leave you with Johnf and Timo who are far more knowledgable about OLE/COM than I am.
I am in windows 64,
the linker options are:
-subsystem:windows -machine:amd64 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp64.lib shell32.lib shlwapi.lib OleAut32.lib Ole32.lib uuid.lib
version 7 RC1 lib\Win64\uuid.lib have underscores before symbol names ?
I think that is a bug ???
You can always enable un-decoration (removing the leading underscore) with a project option.
@ timovjl
thank you,
As you have told me I also think it's probably a bug.
I retrieved the file "uuid.lib" version 6.50 and I made a copy in lib\Win64 Version 7.00 (I saved the original V7)
I then rebuilt, it's OK
@ Stefan
How to remove the underline in project option ?
Thank you all for your responses.
Quote from: timovjl on April 20, 2012, 08:20:27 PM
version 7 RC1 lib\Win64\uuid.lib have underscores before symbol names ?
I think that is a bug ???
Looking at various libs, underscores are the norm. I checked two other compilers uuid.lib and they both have underscores.
John
64-bit libs: x64 uses fastcall calling convention: no underscore.
From pellesC help:
QuoteFASTCALL calling convention
X64:
The name of a function is not decorated. This is the only calling convention used by X64.
Oh, ok.
John