2011-12-01 79 views
0
#include "stdafx.h" 
#include <boost/gil/gil_all.hpp> 
#include <boost/gil/extension/io/png_io.hpp> 
namespace gil = boost::gil; 

int _tmain(int argc, _TCHAR* argv[]) 
{ 

    gil::gray8_image_t input; 
    gil::png_read_image("..\\resources\\frame10.png",input); 

    return 0; 

} 

在主程序中,我想讀取一個PNG圖像。調試沒有問題。但是當我運行 的可執行文件時,它崩潰了。什麼原因?謝謝!如何使用libpng讀取png圖像?

回答

1

這可能是由於你的相對路徑。據我記得,Visual啓動$ PROJECT_DIR調試會話。如果手動啓動exe(從$ PROJECT_DIR/Debug(或Release)),它可能找不到您的資源。