Unresolved external symbol cannot be resolved _ Send @ 16

Source: Internet
Author: User

(1) A compilation problem occurs in VC network programming. It turns out that wsock32.lib is missing.
Add wsock32.lib to project --> Settings --> link --> Object/library modules.
When developing Winsock APIs in VC, you must use the following three files in the project. Otherwise, a compilation error occurs.
1. Winsock. H: This is the header file of Winsock API and must be included in the project.
2. wsock32.lib: Winsock API Connection Library file. In use, it must be included in the project file as a non-default Connection Library of the project.
3. Winsock. dll: the dynamic Connection Library of WinSock, which is located in the installation directory of windows.
------------------ Configuration: example1-Win32 debug --------------------
Linking...
Error lnk2001: unresolved external symbol _ connect @ 12
Error lnk2001: unresolved external symbol _ htons @ 4
Error lnk2001: unresolved external symbol _ inet_addr @ 4
Error lnk2001: unresolved external symbol _ socket @ 12
Error lnk2001: unresolved external symbol _ closesocket @ 4
Error lnk2001: unresolved external symbol _ Send @ 16
Error lnk2001: unresolved external symbol _ Recv @ 16
Error lnk2001: unresolved external symbol _ wsaasyncselect @ 16
Error lnk2001: unresolved external symbol _ Accept @ 12
Error lnk2001: unresolved external symbol _ listen @ 8
Error lnk2001: unresolved external symbol _ bind @ 12
(2) I encountered a problem in the SQL programming of the VC database. It turned out that odbc32.lib was missing.
In project --> Settings --> link --> Object/library modules, add odbc32.lib to the database.
MFC Program When the odbc api is called, an error occurs during connection:
Error lnk2001: unresolved external symbol _ sqlconnect @ 28
Error lnk2001: unresolved external symbol _ sqlfetch @ 4
Error lnk2001: unresolved external symbol _ sqlbindcol @ 24
Error lnk2001: unresolved external symbol _ sqlfreehandle @ 8
Error lnk2001: unresolved external symbol _ sqlexecdirect @ 12
Error lnk2001: unresolved external symbol _ sqlallochandle @ 12
Error lnk2001: unresolved external symbol _ sqlsetenvattr @ 16
Error lnk2001: unresolved external symbol _ sqldisconnect @ 4
(3) There is a problem in VC opencv image processing programming. It turns out that cv. Lib cvaux. Lib cxcore. Lib highgui. Lib is missing.
Add cv. Lib cvaux. Lib cxcore. Lib highgui. lib to project --> Settings --> link --> Object/library modules.
Error lnk2001: unresolved external symbol _ cvreleaseimage
Error lnk2001: unresolved external symbol _ cvwaitkey
Error lnk2001: unresolved external symbol _ cvdrawcontours
Error lnk2001: unresolved external symbol _ cvreleasememstorage
Error lnk2001: unresolved external symbol _ cvdestroywindow
Error lnk2001: unresolved external symbol _ cvfindcontours
Error lnk2001: unresolved external symbol _ cvcvtcolor
Error lnk2001: unresolved external symbol _ cvcreateimage
Error lnk2001: unresolved external symbol _ cvgetsize
Error lnk2001: unresolved external symbol _ cvshowimage
Error lnk2001: unresolved external symbol _ cvloadimage
Error lnk2001: unresolved external symbol _ cvnamedwindow
Error lnk2001: unresolved external symbol _ cvcreatememstorage
(4) There is a problem in VC OpenGL 3D programming. It turns out that opengl32.lib glu32.lib Glaux. Lib is missing.
Add opengl32.lib glu32.lib Glaux. lib to project --> Settings --> link --> Object/library modules.
Error lnk2001: unresolved external symbol _ gluperspective @ 32
Error lnk2001: unresolved external symbol _ glulookat @ 72
Error lnk2001: unresolved external symbol _ imp _ glloadidentity @ 0
Error lnk2001: unresolved external symbol _ imp _ glmatrixmode @ 4
Error lnk2001: unresolved external symbol _ imp _ glviewport @ 16
Error lnk2001: unresolved external symbol _ imp _ glhint @ 8
Error lnk2001: unresolved external symbol _ imp _ gldepthfunc @ 4
Error lnk2001: unresolved external symbol _ imp _ glenable @ 4
Error lnk2001: unresolved external symbol _ imp _ glcleardepth @ 8
Error lnk2001: unresolved external symbol _ imp _ glclearcolor @ 16
Error lnk2001: unresolved external symbol _ imp _ glshademodel @ 4
Error lnk2001: unresolved external symbol _ imp _ glend @ 0
Error lnk2001: unresolved external symbol _ imp _ glvertex3f @ 12
Error lnk2001: unresolved external symbol _ imp _ glbegin @ 4
Error lnk2001: unresolved external symbol _ imp _ gltranslatef @ 12
Error lnk2001: unresolved external symbol _ imp _ glclear @ 4
Error lnk2001: unresolved external symbol _ imp _ wgldeletecontext @ 4
Error lnk2001: unresolved external symbol _ imp _ wglmakecurrent @ 8
Error lnk2001: unresolved external symbol _ imp _ wglcreatecontext @ 4
(5) A problem occurs in vc vfw video collection programming. It turns out that vfw32.lib is missing.
Add vfw32.lib to project --> Settings --> link --> Object/library modules.
Error lnk2001: unresolved external symbol _ capcreatecapture0000wa @ 32
When creating a project, the MFC Appwizard wizard is not used. If the project parameters are not set, many connection errors will be generated during compilation, such as error lnk2001. Typical error prompts include:

Libcmtd. Lib (crt0.obj): Error lnk2001: unresolved external symbol _ main
Libcd. Lib (wincrt0.obj): Error lnk2001: unresolved external symbol _ winmain @ 16
Msvcrtd. Lib (crtexew. OBJ): Error lnk2001: unresolved external symbol _ winmain @ 16
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ beginthreadex
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ endthreadex
Possible causes of errors:
1. Windows subsystem setup error, prompt:
Libcmtd. Lib (crt0.obj): Error lnk2001: unresolved external symbol _ main
For Windows projects, you must use the Windows subsystem instead of the console. You can set it as follows:
[Project] --> [settings] --> select the "Link" property page,
Change/subsystem: console to/subsystem: Windows in project options.
2. the console subsystem settings are incorrect. The following message is displayed:
Libcd. Lib (wincrt0.obj): Error lnk2001: unresolved external symbol _ winmain @ 16
For a console project, use the console subsystem instead of windows. Set:
[Project] --> [settings] --> select the "Link" property page,
Change/subsystem: Windows to/subsystem: console in project options.
3. The program entry settings are incorrect. The prompt is:
Msvcrtd. Lib (crtexew. OBJ): Error lnk2001: unresolved external symbol _ winmain @ 16
Generally, the program entry function of the MFC project is winmain. If the Unicode version of the project is compiled, the program entry must be changed to wwinmaincrtstartup. Therefore, you need to reset the program entry:
[Project] --> [settings] --> select the "C/C ++" attribute page,
In category, select output,
Enter wwinmaincrtstartup in entry-point symbol.
4. When the thread is running, the database settings are incorrect. The prompt is:
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ beginthreadex
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ endthreadex
This is because when MFC uses a multi-threaded library, you need to change the settings:
[Project] --> [settings] --> select the "C/C ++" attribute page,
In category, select code generation,
Select debug multithreaded or multithreaded in the use run-time library.
Where,
Single-threaded single-thread static link library (Release Version)
Multithreaded multi-thread static link library (Release Version)
Multithreaded DLL multi-thread dynamic link library (Release Version)
Debug single-threaded single-thread static link library (debug version)
Debug multithreaded multi-thread static link library (debug version)
Debug multithreaded DLL multi-thread dynamic link library (debug version)
Single thread: When multi-thread calling is not required, it is usually used in DOS environments.
Multithreading: Concurrent Operation
Static Library: link the library directly with the program and run it without the MFC library.
Dynamic library: The corresponding DLL dynamic library is required for the program to run.
Release Version: used for official release
Debug version: used during debugging

Class 2: The program does not add necessary libraries.

When the source program on the copy network is compiled on the local machine, the database used for connection is not added to the newly created Project, therefore, some functions and variables cannot find the defined library file, which leads to errors.

Texture. OBJ: Error lnk2001: unresolved external symbol _ imp _ glenable @ 4
Texture. OBJ: Error lnk2001: unresolved external symbol _ imp _ gltexenvf @ 12
Texture. OBJ: Error lnk2001: unresolved external symbol _ imp _ gltexparameterf @ 12
Texture. OBJ: Error lnk2001: unresolved external symbol _ imp _ glteximage2d @ 36
Texture. OBJ: Error lnk2001: unresolved external symbol _ imp _ glpixelstorei @ 8
Texture. OBJ: Error lnk2001: unresolved external symbol _ auxdibimageloada @ 4

Solution:

1. First find out which libraries are missing, and then add the files of these libraries to moldul/lib in project =, setting =, and link.

2. You can add the following in the source program in the following form:Code:

# Pragma comment (Lib, "opengl32.lib ");
# Pragma comment (Lib, "glu32.lib ");
# Pragma comment (Lib, "Glaux. lib ");

VC compilation error: unresolved external symbol _ imp _ playsounda @ 12 Solution

Add winmm. lib and the header file containing mmsystem. h.

select "project"-> "setting"-> "Link"-> "Object/library modules" and add "winmm. lib.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.