chris_14

Hi folks,


Would you please be so kind to have a quick look at my code I'm trying to compile code for the WinCE platform using Visual C++ 6, but I always get a linker error. The Windows CE SDK has been installed, as project I've selected a simple WinCE Application in Visual C++.


This is the source code, found at http://www.codeguru.com/cpp/w-p/ce/embeddedvisualc/print.php/c9799__1/

#include <msxml.h>

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{

HRESULT hr;
IXMLDOMDocument * pXMLDoc;
IXMLDOMNode * pXDN;

hr = ::CoInitializeEx(NULL, NULL);

return 1;
}



and those are the errors I receive:

Linking...
WinCEApplication.obj : error LNK2001: unresolved external symbol __imp__CoInitializeEx@8
x86emDbg/WinCEApplication.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.



Any pointers to the solution are appreciated ;)
Chris


Re: Visual C++ Language Small Linker Problem

TilakGopi

Hi

Include Objbase.h.
Link Library: Ole32.lib

for mofe info :http://msdn2.microsoft.com/en-us/library/ms695279.aspx

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ Language Small Linker Problem

chris_14

Hi and thanks for your answer. I did it the way you said, but unfortunately the result is still the same. The linker still can't find the CoInitializeEx() function. I also used the #define _WIN32_DCOM statement, as stated in your link, but no effect so far.

What can be wrong Libs are there, Paths are set in Visual C++, however still the linker problem.


Chris




Re: Visual C++ Language Small Linker Problem

Simerjeet

I know this should be obvious, but just to confirm if the windows CE SDK you are using supports COM/DCOM

I remember working on one such COM/DCOM project where I had to custom create my SDK using PlatForm Builder which had support for COM/DCOM

Simer






Re: Visual C++ Language Small Linker Problem

TilakGopi

Is it possible to post ur code

if not , can u forward that to 'gopi_ch@googley.com',if it is permitted.

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ Language Small Linker Problem

chris_14

Hi and thanks to both of you.

@Simerjeet:
How do I verify whether the WinCE SDK does support COM/DCOM


@TilakGopi:
The current source code is as follows:

#define _WIN32_DCOM

#include <msxml.h>
#include <Objbase.h>

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{

HRESULT hr;
IXMLDOMDocument * pXMLDoc;
IXMLDOMNode * pXDN;

hr = ::CoInitializeEx(NULL, NULL);

return 1;
}


There's really not much to it. I just started a project for WinCE, where I could parse an XML file. But the project refuses to link in the very early stages :-(

Chris




Re: Visual C++ Language Small Linker Problem

TilakGopi

Hi ,

R u using VC6.0 or EVC++3.0 or EVC++(4.0)(with pocket pc / smartphone SDKs installed)

I guess , u have to EVC++ for WinCE programming.

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ Language Small Linker Problem

chris_14

Hi,

I'm not sure about that. I can tell you, what I have on my PC according to the start menu and according to what I did, maybe you can extract the information, whether it's EVC or not.

Visual C++ Version 6 was pre-installed on my computer. The CD I installed afterwards says "Windows CE Toolkit for Visual C++ 6.0". New programs installed in the start menu include:
- Windows CE Platform SDK (HPC)
- Windows CE Platform SDK (Palm-size PC)
- Windows CE Tools
--- Remote File Viewer
--- Remote Heap Walker
--- Remote Process Viewer
--- ...

The licence file on the CD states:
"Microsoft Windows CE Toolkit for Visual C++ version 6.0
END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE ..."
and dates back to 10/16/98

Hope this helps you.


Chris




Re: Visual C++ Language Small Linker Problem

TilakGopi

Hi,

There is EVC++ IDE seperately.This is for Pocket PC and Smartphone programming ,we have used.We have ActiveSync software to synchronize devices with desktop.That's it.

I don't about Palm-size PC.Are u able to sync the simple application to device or emulator and get it run If so , it may be problem with the setup file , just check with who has created it .

Thanx,

Ch.T.Gopi kumar.






Re: Visual C++ Language Small Linker Problem

chris_14

Hi,

if I eliminate the line
hr = ::CoInitializeEx(NULL, NULL);
from the source code, the program can be compiled, downloaded to the emulator and executed. Syncing to the emulator is also no problem in Visual C++ 6. Also the simple hello world example in Visual C++ 6 works, however, if I insert the lines given above, the linker goes havoc again :-(
Currently the program is compiled for Handheld PC H/PC Ver 2.00 (x86emu, win32).

Concerning the setup file, where can it be found So far I haven't found, and therefore haven't modified it. So I guess it's the normal setup file Visual C++ created, or am I mistaken here


Chris




Re: Visual C++ Language Small Linker Problem

TilakGopi

Hi,

I can suggest u one thing for the time being.Develop a COM dll ,implement what ever the XML handling part in it and use it it ur application,till the IDE problem solved.

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ Language Small Linker Problem

chris_14

Hi,

one strange thing though. I started a new project in Visual C++ called WinCE ATL COM Application, I guess that's what you meant, didn't you Please give me a short confirmation on that.

Source code looks as follows:

------------------------------------------------------------------
#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "WinCeATLCOMApplication.h"
#include "WinCeATLCOMApplication_i.c"
#include <msxml.h>
#include <objbase.h>

CComModule _Module;

BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()

class CWinCeATLCOMApplicationApp : public CWinApp
{
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
};

CWinCeATLCOMApplicationApp theApp;

BOOL CWinCeATLCOMApplicationApp::InitInstance() {
_Module.Init(ObjectMap, m_hInstance);

HRESULT hr;
IXMLDOMDocument * pXMLDoc;
IXMLDOMNode * pXDN;
hr = CoInitializeEx(NULL, NULL);
return CWinApp::InitInstance();
}
------------------------------------------------------------------

and the thing compiled all the way to the end, including linking and downloading to the target.

Chris









Re: Visual C++ Language Small Linker Problem

JamesSexton

Maybe try...

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPWSTR lpCmdLine,int iCmdShow).

The Command Line probably is in UNICODE and requires a "LongPointerWideString": LPWSTR if you're compiling and linking for mobile (embedded) devices.

JamesSexton

 

 

 






Re: Visual C++ Language Small Linker Problem

Simple Samples

Are you sure you are using the library Ole32.lib The LNK2001 error is a link error, which means that you probably don't need to change your code to solve the problem.




Re: Visual C++ Language Small Linker Problem

TilakGopi

chris_14


Posts 6
Re: Small Linker Problem
Was this post helpful

Hi,

one strange thing though. I started a new project in Visual C++ called WinCE ATL COM Application, I guess that's what you meant, didn't you Please give me a short confirmation on that.

Source code looks as follows:

------------------------------------------------------------------
#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "WinCeATLCOMApplication.h"
#include "WinCeATLCOMApplication_i.c"
#include <msxml.h>
#include <objbase.h>

CComModule _Module;

BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()

class CWinCeATLCOMApplicationApp : public CWinApp
{
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
};

CWinCeATLCOMApplicationApp theApp;

BOOL CWinCeATLCOMApplicationApp::InitInstance() {
_Module.Init(ObjectMap, m_hInstance);

HRESULT hr;
IXMLDOMDocument * pXMLDoc;
IXMLDOMNode * pXDN;
hr = CoInitializeEx(NULL, NULL);
return CWinApp::InitInstance();
}
------------------------------------------------------------------

and the thing compiled all the way to the end, including linking and downloading to the target.

Chris

Hi Chirs , I suppose , i'm not leading u wrong way(suggesting a COM dll for XML Handling - so that this can be used with any other exe also) ,anyways the best way is to sovle ur link prolbem.If possible , can u send me ur code(total project - zipped) to 'gopi_ch@googley.com' ,if i can , i'll solve ur problem.

I don't know how did u generate the above code ,i.e, by selecting which project in the ide , u got the above code.Unfortunately i don't have VC6.0 and VS2003 and VS2005.That's the problem.Anyways i guess it's not a bad idea to develope a COM dll - XML handler.U can use ATL wizard to do this.If ur not comfortable with ATL better go for a simple COM dll.(Ex:http://www.codeproject.com/atl/SimpleATLCom.asp)

Thanx,

Ch.T.Gopi Kumar.