NO

Author Topic: Unresolved external symbol 'IID_IPicture'  (Read 6996 times)

nomis

  • Guest
Unresolved external symbol 'IID_IPicture'
« on: April 20, 2012, 05:00:51 PM »
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)

CommonTater

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #1 on: April 20, 2012, 05:22:22 PM »
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.

JohnF

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #2 on: April 20, 2012, 05:47:07 PM »
Are you linking with olepro32.dll ?

Also #include <olectl.h>

and at the top of your code

extern const IID IID_IPicture;

John



nomis

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #3 on: April 20, 2012, 05:49:45 PM »
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
Code: [Select]
#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);
}


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Unresolved external symbol 'IID_IPicture'
« Reply #4 on: April 20, 2012, 05:51:40 PM »
Code: [Select]
#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.
May the source be with you

CommonTater

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #5 on: April 20, 2012, 05:54:28 PM »
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. 

nomis

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #6 on: April 20, 2012, 05:55:57 PM »
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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Unresolved external symbol 'IID_IPicture'
« Reply #7 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 ???
May the source be with you

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Unresolved external symbol 'IID_IPicture'
« Reply #8 on: April 20, 2012, 08:28:52 PM »
You can always enable un-decoration (removing the leading underscore) with a project option.
---
Stefan

Proud member of the UltraDefrag Development Team

nomis

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #9 on: April 20, 2012, 11:21:37 PM »
@ 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.


JohnF

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #10 on: April 21, 2012, 09:11:26 AM »
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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Unresolved external symbol 'IID_IPicture'
« Reply #11 on: April 21, 2012, 09:17:24 AM »
64-bit libs: x64 uses fastcall calling convention: no underscore.
From pellesC help:
Quote
FASTCALL calling convention
X64:
The name of a function is not decorated. This is the only calling convention used by X64.
« Last Edit: April 21, 2012, 09:27:24 AM by timovjl »
May the source be with you

JohnF

  • Guest
Re: Unresolved external symbol 'IID_IPicture'
« Reply #12 on: April 21, 2012, 09:33:36 AM »
Oh, ok.

John