Robel Sharma
Robel Sharma

Reputation: 972

VS2005 nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv

I get this error when i build a project which have static library input (.lib). The problem is that I can run the project successfully in debug but can't run in release mode.It shows the error as ....

nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc

Please help me to solve this problem.

Upvotes: 2

Views: 4838

Answers (1)

Michael Burr
Michael Burr

Reputation: 340366

Microsoft's KB Q166504 might have the answer for you:

When building an MFC application or DLL, you need to insure that all relevant libraries are in sync:

  • If you have selected to build an application using MFC in the Shared Library, then you must also use the dynamic version of the C Run-Time (MSVCRT.DLL).
  • If you have selected to build a debug MFC application, then you must also use the debug version of the C Run-Time. Similarly, release MFC applications must use the non-debug version of the C Run-Time.
  • If your debug MFC application uses extension DLLs, every extension DLL must be a debug build as well. Again, release apps must match release extension DLLs. The type of C Run-Time library is fixed. Extension DLLs and the applications which use them must all use MFC in the shared library, which requires the dynamic DLL version of the C Run-Time.
  • If you are linking to any static libraries that also link to MFC or the CRT, you should ensure that every static library shares the same properties (debug/release, CRT-static/dynamic) as the application.

RESOLUTION

To change the type of C Run-Time library used by an application or DLL, go to the Build/Project settings property sheet and switch to the C/C++ tab. On the C/C++ page, choose the "Code Generation" category. Change the value of the "Use run-time library" listbox. Pay careful attention to make this specific for each configuration; only one configuration, such as "Win32 (80x86) Debug," should be selected when you change this value.

  • Debug, shared library MFC applications - "Debug Multithreaded Dll."

  • Release, shared library MFC applications - "Multithread Dll."

  • Debug, static library MFC applications - "Debug Multithreaded."

  • Release, static library MFC applications - "Multithreaded."

Upvotes: 1

Related Questions