PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

error LNK2001

Hi all,

I have a big problem in getting an existing C++ source code into the eVC++ version.

I get 197 errors in total during the linking process.

The first 3 examples:

SearchWnd.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const CWnd::messageMap" (?messageMap@EFBWnd@@1UAFX_MSGMAP@@B)

MapWnd.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const CWnd::messageMap" (?messageMap@EFBWnd@@1UAFX_MSGMAP@@B)

SearchWnd.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl CWnd::allocateControls(bool)" (?allocateControls@EFBWnd@@MAAX_N@Z)

As a beginner in programming I really have absolutely no idea how to solve this problem.

Please help me in finding the solution !

Thank you very much in advance.
Terry
Sounds like you have source code that utilizes MFC (Microsoft Foundation Classes), but the project you created is not an MFC project.

Dan East
Riwagn wrote:
As a beginner in programming I really have absolutely no idea how to solve this problem.


don't worry about that, I've been programming for 15 years or more and each time I get this kind of errors, 20 minutes later I'm using the keyboard as a light saber against the tft :)

the days there was no underlying o.s. were a lot better ;) (for me at least)
Hi,

unfortunately its a WCE MFC AppWizz exe - project. So it should be able to use MFC, right ? It don't know how to solve this problem ?!?!

Stefan
Was the workspace and project(s) already provided for you, or did you create them?

Dan East
I can't help specifically, but in general I've found that linkage errors, which are what you listed, are nearly always the result of (a) something not available to the compiler or (b) some sort of conflict.

The (a), check to be sure you list the directories where the required components are... You can do it per-project or globally, either should work. For (b), I'm not so sure, might happen I suppose when you have a global reference and a project reference?
Thank you for all your answers. I hope, we will figure out it soon !


Dan, I had to create the projects by myself ! What does it mean ? Have I done something wrong - I hope so and you know the solution :D

Terry
...and what I've done was creating the projects under eVC++ (WCE Pocket PC 2003 MFC AppWizard exe) and adding the source and header files like in the original version to the eVC++ projects.

I also copied and pasted the libraries + pathes. Was that wrong ? Do I have to use other libs, but which ones ?

I want to solve this, now. It gives me the willies.

Terry
You're probably including a library that you shouldn't be, and it is preventing the mfc library from linking.

Try removing libraries one at a time and see if those specific errors go away. Obviously that will result in additional linker errors if it is not the problematic library, so in that case add it back in.

Also back with Windows CE 1.0 and 2.0 (which required Visual Studio 5.0 and 6.0 respectively) a bug would crop up from time to time where two standard libraries were linked in the wrong order. The trick to fix it was to tell the linker to ignore the two conflicting libraries, and then to specify them explicitly in the correct order. Your problem could be something along those lines as well, since you specified various libraries manually.

Dan East
Hi,

Are there any special message map declarations/macros for WinCE ? I think I am not allowed to use ON_WM_CREATE etc...Could that be the problem ?

BEGIN_MSG_MAP( EFBWnd, CWnd )
ON_WM_CREATE()
ON_WM_SHOWWINDOW()
ON_WM_SYSKEYUP()
END_MSG_MAP()

Thank you,
Terry
Riwagn · 13 Jun 2005, 20:52 UTC — Poject - Dependencies
Hi,

I have another question.

It came into my mind that the problem could be that I created several projects within a workspace.
So do you know if there exist any dependency ? Do I have to tell them something that they know each other and can interact ?

Would this be a solution ?

Thank you
I know for a fact that ON_WM_CREATE and ON_WM_SHOWWINDOW are supported. Those are very rudimentary, and are often used.

I just took another look at your linker errors. allocateControls is not familiar to me. I searched the MFC source code (the entire source code is provided by MS - it should already be installed for you as well) for allocateControls and that text does not exist in either the headers or the MFC source. That string doesn't even get any hits with Google. So that is definitely not part of MFC. Are you sure the source code you're working with builds for any (ie non-Windows CE) target?

Dan East