0
this code을 사용하여 bmp를 png로 변환하려고합니다. Here is the full lib's content. 제발오류 : LNK1120 : 해결되지 않은 외부 3 개
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]);
}
어떤 기발한 생각이 문제를 해결하기 위해 다음과 같습니다
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)" ([email protected]@@[email protected][email protected]@[email protected]@@[email protected]@[email protected]@@[email protected]) 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 &)" ([email protected]@@[email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@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 &)" ([email protected]@@[email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function _main
주요 코드는 다음과 같습니다 그러나, 그 다음과 같은 오류를 유발하고?
고맙습니다.
'lodepng'는 어디에 정의되었으며 어떻게 포함합니까? 어떤 명령을 사용하여 프로그램을 컴파일하고 링크합니까? 나는이 라이브러리가 당신이 그것을 링크 할 것을 요구하지만 당신은 링커에게 명령을주지 않았 음을 짐작할 것이다. 'gcc' 나 비슷한 것을 사용한다면 링커에게'-lmy_library_name' 명령을 주어야합니다. – shuttle87
다음은 [lodepng.h] (http://lpi.googlecode.com/svn/trunk/lodepng.h)입니다. 방금이 두 파일을 다운로드하고 Windows 7 SP1 판에서 Visual Studio Ultimate 2013을 사용하여 새 C++ 프로젝트를 만들고이를 프로젝트에 추가 한 다음이를 삭제합니다. – user3472134
'main' 함수가 들어있는 파일에서'loadpng'와 관련된 코드를 모두 제공해야합니다. – shuttle87