Linker error when adding Ole to my application, what am I missing?
-
I'm trying to get some code to run to work around another issue, and for the life of me, I cannot make the VS2008 linker happy. This is for a smart device, Windows Embedded Compact 7, but I think the target is only a symptom. I've tried this against 3 different SDKs for VS2008 as well as EVC++ (going way back) and two different SDKs - all have the same issue. I need the application to run OLE. So, I created a very simple dialog app - think default code base, C++. It compiles and links. I then add one call: "OleInitialize(0);" and I get this:
Quote:
1>Linking... 1>OleTest.obj : error LNK2019: unresolved external symbol OleInitialize referenced in function "public: virtual int __cdecl COleTestApp::InitInstance(void)" (?InitInstance@COleTestApp@@UAAHXZ)
You can say I need to add an input to the linker line for ole32.lib, but it still fails. Oddly, VS2008 shows that I've inherited these from the solution. Of course the desktop links fine. Any random or "oh crap, yeah, I had that problem" ideas? It's almost as if the ole32.lib doesn't have OleInitialize. I could believe that for one SDK but not 5.
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
-
I'm trying to get some code to run to work around another issue, and for the life of me, I cannot make the VS2008 linker happy. This is for a smart device, Windows Embedded Compact 7, but I think the target is only a symptom. I've tried this against 3 different SDKs for VS2008 as well as EVC++ (going way back) and two different SDKs - all have the same issue. I need the application to run OLE. So, I created a very simple dialog app - think default code base, C++. It compiles and links. I then add one call: "OleInitialize(0);" and I get this:
Quote:
1>Linking... 1>OleTest.obj : error LNK2019: unresolved external symbol OleInitialize referenced in function "public: virtual int __cdecl COleTestApp::InitInstance(void)" (?InitInstance@COleTestApp@@UAAHXZ)
You can say I need to add an input to the linker line for ole32.lib, but it still fails. Oddly, VS2008 shows that I've inherited these from the solution. Of course the desktop links fine. Any random or "oh crap, yeah, I had that problem" ideas? It's almost as if the ole32.lib doesn't have OleInitialize. I could believe that for one SDK but not 5.
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
-
I'm trying to get some code to run to work around another issue, and for the life of me, I cannot make the VS2008 linker happy. This is for a smart device, Windows Embedded Compact 7, but I think the target is only a symptom. I've tried this against 3 different SDKs for VS2008 as well as EVC++ (going way back) and two different SDKs - all have the same issue. I need the application to run OLE. So, I created a very simple dialog app - think default code base, C++. It compiles and links. I then add one call: "OleInitialize(0);" and I get this:
Quote:
1>Linking... 1>OleTest.obj : error LNK2019: unresolved external symbol OleInitialize referenced in function "public: virtual int __cdecl COleTestApp::InitInstance(void)" (?InitInstance@COleTestApp@@UAAHXZ)
You can say I need to add an input to the linker line for ole32.lib, but it still fails. Oddly, VS2008 shows that I've inherited these from the solution. Of course the desktop links fine. Any random or "oh crap, yeah, I had that problem" ideas? It's almost as if the ole32.lib doesn't have OleInitialize. I could believe that for one SDK but not 5.
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
Hi, Have you tried using CoInitializeEx? [Determining Supported COM APIs (Windows CE 5.0) | Microsoft Learn](https://learn.microsoft.com/en-us/previous-versions/windows/embedded/ms862136(v=msdn.10))
-
As rough guess, the linker is not able to find the ole32 library for the embedded platform target (the reason I really don't know).
"In testa che avete, Signor di Ceprano?" -- Rigoletto
Well that's the obvious thing, but for the life of me I don't know why. I have other code that links with a few non-default libraries, and these are found fine. I searched my SDKs, and all of them have the library in question. Very weird.
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
-
Hi, Have you tried using CoInitializeEx? [Determining Supported COM APIs (Windows CE 5.0) | Microsoft Learn](https://learn.microsoft.com/en-us/previous-versions/windows/embedded/ms862136(v=msdn.10))
Give that man a cigar! It had to be something stupid like that - I didn't pick up on that because if I hit :: - OleInitialize is actually in the popup. I guess it's in a header file but not in the binary. Thank you
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
-
Give that man a cigar! It had to be something stupid like that - I didn't pick up on that because if I hit :: - OleInitialize is actually in the popup. I guess it's in a header file but not in the binary. Thank you
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.