Solution to the problem that libjpeg cannot be linked under vs2015

The first version used is 9a, which will appear when we link the jpeg library

1>jpeg.lib(jerror.obj) : error LNK2001: unresolved external symbol __imp_sprintf
1>jpeg.lib(jerror.obj) : error LNK2001: unresolved external symbol __imp___iob_func
1>jpeg.lib(jerror. obj) : error LNK2001: unresolved external symbol __imp_fprintf
1>jpeg.lib(jmemmgr.obj) : error LNK2001: unresolved external symbol __imp_sscanf

Refer to http://blog.csdn.net/mangobar/article/details/53231309 for the reason.

The solution is to add legacy_stdio_definitions.lib to the linker.

Then the link error is left with 1>jpeg.lib(jerror.obj) : error LNK2001: unresolved external symbol __imp___iob_func

For this we need to add extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; } to our linked cpp file (or whatever). Then compile and pass.

Participate in http://tieba.baidu.com/p/4034517162

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326036102&siteId=291194637