Re: Error LNK2028 unresolved token / LNK2019 Unrevolved external symbol



Hi SQACPP,

I'm trying to understand an error when compiling a C++ form project :

1- Create a C++ win32 console application with the defaults parameters
3- Compile the console application
-> It compile without any error

4- Now Create a C+ Form application with the default parameters when
hNotepad = FindWindow(L"Notepad", 0);
** Now the compiler return errors :

The difference between the two is that the first is a native C++ project, while the second is a managed C++ project.

The latter is a different language, formally called C++/CLI, that targets the .NET platform rather than the native Win32 platform. C++/CLI allows you to mix in native C++ pretty much at will, but using C++/CLI causes your app to depend on the .NET framework.

The reason your C++/CLI project doesn't have user32.lib setup in the linker input is that the .NET framework already provides similar services, and the IDE assumes that you want to prefer those to the older, native ones.

So, either you can use the managed way of doing FindWindow, etc. (in which case you might as well just switch to C#) or you can create a native UI project (MFC, most likely) and have access to the full Win32 API, or you can mix; ..NET for the UI and native C++ for the back-end.

The last alternative is probably the one likely to cause you the most grief with all the switching between native and managed code.

FWIW,
- Kim



.



Relevant Pages

  • Re: Statement on backwards compatibility?
    ... > this fundamental statement of WIN32 compatibility guarantee. ... No compile errors or warnings and I was able to run it all ... >> The terms upwards and backwards compatibility are a little ambiguous, ... >> refer to the expectation that products compiled on a higher O/S ...
    (microsoft.public.win32.programmer.kernel)
  • Re: [Python-Dev] compiling python2.5 on linux under wine
    ... webkit itself comes in at 10mb alone. ... libxslt1 and libxml2 have compile errors in mutually incompatible ... versions on win32, plus, unfortunately, the versions that _do_ compile ... i tried hunting down python-gobject and python-gtk for win32, ...
    (comp.lang.python)
  • What are the equivalent Win32 API for Dotnet Framework API ?
    ... This article identifies the Microsoft .NET Framework version ... or 1.1 APIs that provide similar functionality to Microsoft Win32 ... Win32 function listed. ...
    (microsoft.public.dotnet.general)
  • Re: Statement on backwards compatibility?
    ... >>> this fundamental statement of WIN32 compatibility guarantee. ... No compile errors or warnings and I was able to run it all ... >>> go as far as saying LEGAL commitment) to their WIN32 developer base. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: What does ".NET" application mean ?
    ... >> There is a growing list of .NET compliant languages. ... >> It means that the .NET Framework is installed. ... and a runtime environment which includes the virtual machine. ... has been ported since all the .NET languages compile to the ...
    (microsoft.public.windowsxp.setup_deployment)