I'm trying to use this code to convert bmp to png. Here is the full lib's content. But, doing that triggers the following errors:
LNK1120: 3 unresolved externals
----- LNK2019: unresolved external symbol "unsigned int __cdecl lodepng::encode(class std::vector<unsigned char,class std::allocator<unsigned char> > &,class std::vector<unsigned char,class std::allocator<unsigned char> > const &,unsigned int,unsigned int,enum LodePNGColorType,unsigned int)" (?encode@lodepng@@YAIAAV?$vector@EV?$allocator@E@std@@@std@@ABV23@IIW4LodePNGColorType@@I@Z) referenced in function _main
----- LNK2019: unresolved external symbol "void __cdecl lodepng::load_file(class std::vector<unsigned char,class std::allocator<unsigned char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?load_file@lodepng@@YAXAAV?$vector@EV?$allocator@E@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z) referenced in function _main
----- LNK2019: unresolved external symbol "void __cdecl lodepng::save_file(class std::vector<unsigned char,class std::allocator<unsigned char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?save_file@lodepng@@YAXABV?$vector@EV?$allocator@E@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z) referenced in function _main
Here is the main code:
int main(int argc, char *argv[])
{
if (argc < 3)
{
std::cout << "Please provice input PNG and output BMP file names" << std::endl;
return 0;
}
std::vector<unsigned char> bmp;
lodepng::load_file(bmp, argv[1]);
std::vector<unsigned char> image;
unsigned w = 1600, h = 900;
unsigned error = decodeBMP(image, w, h, bmp);
if (error)
{
std::cout << "BMP decoding error " << error << std::endl;
return 0;
}
std::vector<unsigned char> png;
error = lodepng::encode(png, image, w, h);
if (error)
{
//std::cout << "PNG encoding error " << error << ": " << lodepng_error_text(error) << std::endl;
return 0;
}
lodepng::save_file(png, argv[2]);
}
Any brilliant idea to fix this, please?
Thanks a lot!