PNG文件已损坏或内存不足

时间:2014-08-31 10:22:21

标签: perl wxwidgets activestate

使用 wxWidgets 编写我的第一个应用程序,编译所有内容&运行正常,直到我尝试为应用程序的工具栏加载一些图像!

它总是抛出: PNG文件被ASCII转换损坏 The first screen (only appears in debug configuration) The second screen which shows both errors 我编写了一个简单的 perl 脚本,将 PNG 转换为可编译的& 标题,然后通过在线地球搜索此问题的解决方案进行了大量修改,其来源如下:

#!/usr/bin/perl

# Script to convert all PNGs in ./png folder
# to C/CPP headers for embedding in apkstudio
# binary.
#
# Written by: Vaibhav Pandey <contact@vaibhavpandey.com>

# Declaring used namespaces
use Cwd;
use File::Basename;

# Converts the binary file to C/CPP header
sub Convert {
  my $png = $_[0];
  Print("Converting: ${png}");
  # Extract base filename from absolute path
  $name = File::Basename::basename($png, '.png');
  # Clear variables & read png file
  local $/ = undef;
  open FILE, "${png}" or die "Cannot read: ${png}\n";
  $input = <FILE>;
  close FILE;
  # Explode input to unsigned char*
  @characters = unpack "C*", $input;
  # Write input to output
  $namespace = uc $name;
  print HEADER "    static const unsigned char* ${name}_png;\n";
  print CPP "static const unsigned char _${name}_png[] = {\n    ";
  foreach $character (@characters) {
    printf CPP '0x%02x', $character;
    last if $i == $#characters;
    print CPP ((++$i % 13) ? ', ' : ",\n    ");
  }
  print CPP "\n};\n";
  print CPP "const unsigned char* Embedded::${name}_png = _${name}_png;\n\n";
}

# Closes the namespace & class enclosure of the source file
sub FooterCpp {
  print CPP "} // namespace Embedded\n";
  print CPP "} // namespace APKStudio\n";
  print CPP "} // namespace VPZ\n\n";
}

# Closes the namespace & class enclosure of the header file
sub FooterHeader {
  print HEADER "\n};\n\n";
  print HEADER "} // namespace Embedded\n";
  print HEADER "} // namespace APKStudio\n";
  print HEADER "} // namespace VPZ\n\n";
  print HEADER "#endif // VPZ_APKSTUDIO_RESOURCE_EMBEDDED\n";
}

# Write the namespace & class enclosure to the source file
sub HeaderCpp {
  print CPP "// Generated by resources.pl. Do not modify.\n";
  print CPP "#include \"embedded.h\"\n\n";
  print CPP "namespace VPZ {\n";
  print CPP "namespace APKStudio {\n";
  print CPP "namespace Resource {\n\n";
}

# Write the namespace & class enclosure to the header file
sub HeaderHeader {
  print HEADER "// Generated by resources.pl. Do not modify.\n";
  print HEADER "#ifndef VPZ_APKSTUDIO_RESOURCE_EMBEDDED\n";
  print HEADER "#define VPZ_APKSTUDIO_RESOURCE_EMBEDDED\n\n";
  print HEADER "#include <wx/bitmap.h>\n\n";
  print HEADER "namespace VPZ {\n";
  print HEADER "namespace APKStudio {\n";
  print HEADER "namespace Resource {\n\n";
  print HEADER "class Embedded {\n\n";
  print HEADER "public:\n";
}

# Prints output to console with an EOL auto-appended
sub Print {
  my $text = $_[0];
  print "${text}\n";
}

# Scans for PNG files recursively in a folder
sub Scan {
  my $folder = $_[0];
  # Check if is not a folder
  if (! -d $folder) {
    Print("Not a folder: ${folder}");
    return;
  }
  Print("Scanning: ${folder}");
  # Try to open folder for scanning
  opendir DIR, $folder or die $!;
  # Loop through all the files inside
  while ($entry = readdir DIR) {
    # Skip . & .. files
    next if substr($entry, 0, 1) eq ".";
    my $path = "${folder}/${entry}";
    Print("Found: ${path}");
    if (-d $path) {
      # Scan recursively if found a folder
      ::Scan($path);
    } elsif (-f $path) {
      # Continue if not a PNG file
      next unless $entry =~ m/\.png$/;
      # Finally convert if is valid
      ::Convert($path);
    }
  }
  # Close the opened directory handle
  closedir(DIR);
}

# Get current working directory
$wd = Cwd::getcwd();
# Compute absolute path for C/CPP header
my $header = "${wd}/embedded.h";
my $cpp = "${wd}/embedded.cpp";
# Open output stream for writing
open HEADER, ">${header}" or die "Cannot write: ${header}\n";
open CPP, ">${cpp}" or die "Cannot write: ${cpp}\n";
HeaderHeader(HEADER);
HeaderCpp(CPP);
# Fires up the whole thing
::Scan("${wd}/png");
# Close the already open header file
FooterHeader(HEADER);
FooterCpp(CPP);
close CPP;
close HEADER;

对我而言,它似乎已经将PNG视为文本,而不是二进制模式(我还不确定,因为我从未处理过 Perl wxWidgets ,这是我的第二个 C ++ 应用程序!)

我也试过了perl脚本here中的官方(看起来像网站上的特色),但它是一样的。此外,我通过两个脚本验证了输出的数组元素,我的和似乎是官方的,并且如下:

static const unsigned char _android_png[] = {
    0x89, 0x50, 0x4e, 0x47, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48,
    0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00,
    0x00, 0x00, 0x1f, 0xf3, 0xff, 0x61, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58,
    0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, 0x64, 0x6f,
    0x62, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x61, 0x64, 0x79,
    0x71, 0xc9, 0x65, 0x3c, 0x00, 0x00, 0x03, 0x69, 0x69, 0x54, 0x58, 0x74, 0x58,
    0x4d, 0x4c, 0x3a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e,
    0x78, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3f, 0x78, 0x70, 0x61,
    0x63, 0x6b, 0x65, 0x74, 0x20, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x3d, 0x22, 0xef,
    0xbb, 0xbf, 0x22, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x57, 0x35, 0x4d, 0x30, 0x4d,
    0x70, 0x43, 0x65, 0x68, 0x69, 0x48, 0x7a, 0x72, 0x65, 0x53, 0x7a, 0x4e, 0x54,
    0x63, 0x7a, 0x6b, 0x63, 0x39, 0x64, 0x22, 0x3f, 0x3e, 0x20, 0x3c, 0x78, 0x3a,
    0x78, 0x6d, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73,
    0x3a, 0x78, 0x3d, 0x22, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x3a, 0x6e, 0x73, 0x3a,
    0x6d, 0x65, 0x74, 0x61, 0x2f, 0x22, 0x20, 0x78, 0x3a, 0x78, 0x6d, 0x70, 0x74,
    0x6b, 0x3d, 0x22, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x58, 0x4d, 0x50, 0x20,
    0x43, 0x6f, 0x72, 0x65, 0x20, 0x35, 0x2e, 0x30, 0x2d, 0x63, 0x30, 0x36, 0x30,
    0x20, 0x36, 0x31, 0x2e, 0x31, 0x33, 0x34, 0x37, 0x37, 0x37, 0x2c, 0x20, 0x32,
    0x30, 0x31, 0x30, 0x2f, 0x30, 0x32, 0x2f, 0x31, 0x32, 0x2d, 0x31, 0x37, 0x3a,
    0x33, 0x32, 0x3a, 0x30, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
    0x22, 0x3e, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x20, 0x78,
    0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x72, 0x64, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74,
    0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72,
    0x67, 0x2f, 0x31, 0x39, 0x39, 0x39, 0x2f, 0x30, 0x32, 0x2f, 0x32, 0x32, 0x2d,
    0x72, 0x64, 0x66, 0x2d, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x2d, 0x6e, 0x73,
    0x23, 0x22, 0x3e, 0x20, 0x3c, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73, 0x63,
    0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x64, 0x66, 0x3a, 0x61,
    0x62, 0x6f, 0x75, 0x74, 0x3d, 0x22, 0x22, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73,
    0x3a, 0x78, 0x6d, 0x70, 0x52, 0x69, 0x67, 0x68, 0x74, 0x73, 0x3d, 0x22, 0x68,
    0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62,
    0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30,
    0x2f, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x2f, 0x22, 0x20, 0x78, 0x6d, 0x6c,
    0x6e, 0x73, 0x3a, 0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3d, 0x22, 0x68, 0x74, 0x74,
    0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e,
    0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x6d,
    0x6d, 0x2f, 0x22, 0x20, 0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x73, 0x74, 0x52,
    0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73,
    0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61,
    0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x2f, 0x52,
    0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x66, 0x23, 0x22, 0x20,
    0x78, 0x6d, 0x6c, 0x6e, 0x73, 0x3a, 0x78, 0x6d, 0x70, 0x3d, 0x22, 0x68, 0x74,
    0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6e, 0x73, 0x2e, 0x61, 0x64, 0x6f, 0x62, 0x65,
    0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x61, 0x70, 0x2f, 0x31, 0x2e, 0x30, 0x2f,
    0x22, 0x20, 0x78, 0x6d, 0x70, 0x52, 0x69, 0x67, 0x68, 0x74, 0x73, 0x3a, 0x4d,
    0x61, 0x72, 0x6b, 0x65, 0x64, 0x3d, 0x22, 0x46, 0x61, 0x6c, 0x73, 0x65, 0x22,
    0x20, 0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3a, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65,
    0x6e, 0x74, 0x49, 0x44, 0x3d, 0x22, 0x78, 0x6d, 0x70, 0x2e, 0x64, 0x69, 0x64,
    0x3a, 0x39, 0x41, 0x31, 0x42, 0x43, 0x43, 0x37, 0x43, 0x38, 0x42, 0x31, 0x46,
    0x31, 0x31, 0x45, 0x30, 0x41, 0x42, 0x35, 0x33, 0x44, 0x38, 0x45, 0x42, 0x33,
    0x45, 0x33, 0x43, 0x42, 0x38, 0x34, 0x31, 0x22, 0x20, 0x78, 0x6d, 0x70, 0x4d,
    0x4d, 0x3a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x3d,
    0x22, 0x78, 0x6d, 0x70, 0x2e, 0x69, 0x69, 0x64, 0x3a, 0x39, 0x41, 0x31, 0x42,
    0x43, 0x43, 0x37, 0x42, 0x38, 0x42, 0x31, 0x46, 0x31, 0x31, 0x45, 0x30, 0x41,
    0x42, 0x35, 0x33, 0x44, 0x38, 0x45, 0x42, 0x33, 0x45, 0x33, 0x43, 0x42, 0x38,
    0x34, 0x31, 0x22, 0x20, 0x78, 0x6d, 0x70, 0x3a, 0x43, 0x72, 0x65, 0x61, 0x74,
    0x6f, 0x72, 0x54, 0x6f, 0x6f, 0x6c, 0x3d, 0x22, 0x41, 0x64, 0x6f, 0x62, 0x65,
    0x20, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x20, 0x43, 0x53,
    0x33, 0x20, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x22, 0x3e, 0x20, 0x3c,
    0x78, 0x6d, 0x70, 0x4d, 0x4d, 0x3a, 0x44, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64,
    0x46, 0x72, 0x6f, 0x6d, 0x20, 0x73, 0x74, 0x52, 0x65, 0x66, 0x3a, 0x69, 0x6e,
    0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x3d, 0x22, 0x75, 0x75, 0x69,
    0x64, 0x3a, 0x41, 0x43, 0x31, 0x46, 0x32, 0x45, 0x38, 0x33, 0x33, 0x32, 0x34,
    0x41, 0x44, 0x46, 0x31, 0x31, 0x41, 0x41, 0x42, 0x38, 0x43, 0x35, 0x33, 0x39,
    0x30, 0x44, 0x38, 0x35, 0x42, 0x35, 0x42, 0x33, 0x22, 0x20, 0x73, 0x74, 0x52,
    0x65, 0x66, 0x3a, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x44,
    0x3d, 0x22, 0x75, 0x75, 0x69, 0x64, 0x3a, 0x43, 0x39, 0x44, 0x33, 0x34, 0x39,
    0x36, 0x36, 0x34, 0x41, 0x33, 0x43, 0x44, 0x44, 0x31, 0x31, 0x42, 0x30, 0x38,
    0x41, 0x42, 0x42, 0x42, 0x43, 0x46, 0x46, 0x31, 0x37, 0x32, 0x31, 0x35, 0x36,
    0x22, 0x2f, 0x3e, 0x20, 0x3c, 0x2f, 0x72, 0x64, 0x66, 0x3a, 0x44, 0x65, 0x73,
    0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3e, 0x20, 0x3c, 0x2f, 0x72,
    0x64, 0x66, 0x3a, 0x52, 0x44, 0x46, 0x3e, 0x20, 0x3c, 0x2f, 0x78, 0x3a, 0x78,
    0x6d, 0x70, 0x6d, 0x65, 0x74, 0x61, 0x3e, 0x20, 0x3c, 0x3f, 0x78, 0x70, 0x61,
    0x63, 0x6b, 0x65, 0x74, 0x20, 0x65, 0x6e, 0x64, 0x3d, 0x22, 0x72, 0x22, 0x3f,
    0x3e, 0x27, 0x66, 0xfb, 0x9f, 0x00, 0x00, 0x02, 0xcb, 0x49, 0x44, 0x41, 0x54,
    0x78, 0xda, 0x8c, 0x52, 0x4b, 0x4f, 0x13, 0x51, 0x14, 0xfe, 0x66, 0x7a, 0xfb,
    0x18, 0x68, 0xa7, 0xbc, 0x8a, 0x50, 0x25, 0x22, 0xc6, 0x18, 0x94, 0x44, 0x08,
    0x24, 0x36, 0x69, 0xdc, 0xb8, 0x81, 0x44, 0xc5, 0xe8, 0xa2, 0x0b, 0x13, 0x49,
    0x64, 0xc1, 0xca, 0x3f, 0x20, 0xee, 0x8d, 0x2b, 0x37, 0xee, 0xba, 0xc0, 0x84,
    0xc4, 0x18, 0xd8, 0x68, 0x84, 0x10, 0x1b, 0x34, 0x71, 0x25, 0x4d, 0x28, 0x62,
    0x0d, 0xc5, 0xf2, 0x12, 0x79, 0x95, 0x47, 0x4b, 0x81, 0x29, 0xd3, 0x96, 0xf6,
    0xb6, 0xe3, 0x99, 0xb6, 0x20, 0x89, 0x0b, 0xbd, 0x93, 0x93, 0x7b, 0xce, 0x9c,
    0xef, 0x7c, 0xf7, 0x9c, 0x2f, 0x47, 0xc0, 0x90, 0x03, 0xa5, 0x13, 0x40, 0x5e,
    0xeb, 0x06, 0xcf, 0x47, 0x60, 0x10, 0xf0, 0xd7, 0xc9, 0x69, 0x00, 0x13, 0x9d,
    0x10, 0x85, 0xf7, 0x14, 0x75, 0xe8, 0xbf, 0x34, 0xcf, 0x0e, 0x18, 0x34, 0xad,
    0x08, 0xd0, 0xd0, 0x4d, 0x04, 0x7a, 0xb2, 0x9f, 0xfc, 0x3b, 0x74, 0x5f, 0x21,
    0xb3, 0x91, 0x25, 0xc8, 0x66, 0xc9, 0x46, 0x28, 0xff, 0x8c, 0xee, 0x6e, 0x9c,
    0xe2, 0x67, 0xd8, 0x4d, 0x15, 0x3d, 0x51, 0x88, 0xc0, 0x64, 0x78, 0x23, 0x5b,
    0xed, 0xcf, 0x3b, 0x9a, 0x3b, 0xce, 0x9f, 0xad, 0x39, 0x27, 0x1b, 0x99, 0x91,
    0x65, 0xb2, 0x19, 0xbe, 0x1e, 0x5b, 0x6f, 0xfd, 0x1a, 0x0e, 0xb8, 0x95, 0x43,
    0xe5, 0x35, 0x32, 0xb9, 0x08, 0x11, 0x9d, 0x10, 0x88, 0x27, 0x9e, 0x86, 0x9b,
    0x95, 0x16, 0xb9, 0xe7, 0x46, 0xb3, 0xbb, 0x65, 0x77, 0x71, 0xa3, 0x6a, 0x63,
    0xf9, 0x17, 0x8b, 0xc7, 0xe3, 0x58, 0x59, 0x5a, 0x62, 0xd1, 0xc5, 0xb5, 0x2a,
    0x22, 0x6d, 0xb1, 0x59, 0xca, 0x7b, 0x74, 0xdc, 0xe9, 0xc9, 0x44, 0x58, 0x18,
    0x90, 0xcd, 0x01, 0x19, 0xfe, 0xc8, 0x75, 0xcd, 0xdd, 0xb8, 0x1c, 0x9e, 0x37,
    0x7e, 0xbb, 0xe7, 0xc7, 0xf4, 0x97, 0x09, 0x6c, 0x45, 0xb6, 0x10, 0x9c, 0xf0,
    0x63, 0xe6, 0xfe, 0x24, 0xe6, 0x7f, 0xcc, 0x18, 0x2f, 0xb4, 0x5c, 0x6c, 0xd4,
    0x71, 0x05, 0xbc, 0x5e, 0x57, 0x18, 0xc1, 0x6a, 0x02, 0x8c, 0xd4, 0xc8, 0x66,
    0xa2, 0xa9, 0x52, 0xae, 0xb6, 0x2a, 0x67, 0x14, 0x3c, 0xfe, 0xfe, 0x04, 0x35,
    0x0d, 0x0d, 0xd8, 0xde, 0xde, 0x86, 0xb9, 0xc6, 0x0e, 0xcf, 0x64, 0x2f, 0x72,
    0xb5, 0x06, 0xa4, 0x6d, 0x19, 0x2b, 0x8e, 0x78, 0x13, 0xea, 0x49, 0x1a, 0xf3,
    0x31, 0x81, 0x86, 0x3e, 0x0a, 0xfa, 0x90, 0xc9, 0x23, 0x14, 0x0a, 0x89, 0xb1,
    0x58, 0x0c, 0xb3, 0xe1, 0x30, 0x32, 0xaa, 0x0a, 0x35, 0x1a, 0x85, 0x89, 0x31,
    0x7c, 0x3a, 0x18, 0x83, 0x5c, 0x5d, 0x0d, 0x73, 0x82, 0x89, 0x84, 0x33, 0x13,
    0x3e, 0x40, 0x75, 0x5e, 0xaa, 0xf7, 0x0a, 0x18, 0xac, 0x0c, 0xf4, 0x76, 0xf5,
    0xb6, 0x07, 0x83, 0x41, 0xb4, 0xb5, 0xb6, 0x21, 0x15, 0x4f, 0xc2, 0x94, 0x65,
    0x64, 0x46, 0xa8, 0x8a, 0x8a, 0xb4, 0x90, 0x46, 0x42, 0x3a, 0xc4, 0xbe, 0x4d,
    0x81, 0x22, 0x27, 0x50, 0x16, 0x2a, 0x43, 0xf4, 0x6a, 0x14, 0xab, 0x1f, 0x57,
    0xa7, 0xb4, 0x87, 0xf1, 0x0e, 0x86, 0x64, 0x16, 0x9c, 0xf3, 0x42, 0x3b, 0xc9,
    0x54, 0x12, 0x6b, 0xb1, 0x35, 0x24, 0x93, 0x49, 0xa4, 0xd4, 0x14, 0xa2, 0xd4,
    0x01, 0x67, 0x94, 0xab, 0xa4, 0x64, 0x35, 0x20, 0x19, 0x25, 0x94, 0xd1, 0xc7,
    0x73, 0xf4, 0x8f, 0xea, 0x8a, 0x22, 0x96, 0x9c, 0xbd, 0xbd, 0x3d, 0xfc, 0xcf,
    0x39, 0xc1, 0x95, 0xea, 0x18, 0xd2, 0xdc, 0x3b, 0xf8, 0xea, 0x65, 0x9f, 0x1e,
    0xb8, 0x5c, 0xae, 0xf6, 0x7f, 0x11, 0xfc, 0x5c, 0x98, 0x9e, 0xc2, 0x02, 0x39,
    0x82, 0xe0, 0x2d, 0x89, 0xa8, 0x79, 0x49, 0x29, 0x2f, 0xea, 0x6c, 0xfe, 0xe8,
    0xee, 0xb6, 0x22, 0x49, 0x92, 0xac, 0xe9, 0xdb, 0x99, 0xa7, 0x96, 0x25, 0xa9,
    0x38, 0x82, 0x85, 0x90, 0x12, 0xc0, 0xe3, 0xd9, 0x03, 0x38, 0x2b, 0x38, 0xa2,
    0x87, 0x2e, 0x64, 0x79, 0xa9, 0x03, 0xfd, 0xd8, 0xca, 0x81, 0x7d, 0xee, 0x1d,
    0x7f, 0x37, 0xe2, 0x81, 0x9a, 0xc1, 0x65, 0xf7, 0xf5, 0xce, 0xb9, 0x31, 0xbf,
    0x0f, 0x07, 0x3a, 0x42, 0x44, 0xed, 0xdd, 0x4b, 0x9d, 0x3b, 0xbe, 0x15, 0x1f,
    0x64, 0x03, 0xe9, 0xc1, 0x86, 0x51, 0x5e, 0x46, 0x78, 0xa5, 0x44, 0xf0, 0x34,
    0xaf, 0x4f, 0x06, 0x74, 0x99, 0x07, 0x20, 0xf3, 0x01, 0xd8, 0xb5, 0x51, 0x87,
    0xc3, 0x81, 0xb9, 0x34, 0x38, 0xed, 0xfc, 0x6d, 0x5a, 0xdb, 0x51, 0x66, 0xa7,
    0x77, 0x14, 0x9e, 0xc3, 0x46, 0xfe, 0x16, 0x0e, 0xe8, 0x65, 0xdf, 0x51, 0x71,
    0x9e, 0xfe, 0xe3, 0x0e, 0x40, 0xd2, 0x7e, 0x38, 0x92, 0x0b, 0xa2, 0x3e, 0x40,
    0x05, 0x63, 0xfa, 0x76, 0xa2, 0x02, 0x43, 0x70, 0xc2, 0xa3, 0x15, 0xe3, 0x54,
    0xde, 0x8e, 0x61, 0xee, 0x2c, 0x2c, 0x3d, 0xd1, 0x91, 0xa9, 0x7f, 0x46, 0xd0,
    0x09, 0x80, 0x3a, 0x32, 0x03, 0xd6, 0x30, 0xfe, 0xf9, 0xc5, 0x5b, 0x1b, 0x22,
    0x18, 0xa7, 0xb8, 0x5e, 0xbf, 0x57, 0xbd, 0x41, 0x1b, 0x36, 0x85, 0x62, 0x5c,
    0x50, 0x07, 0xb9, 0x63, 0x82, 0xdf, 0x02, 0x0c, 0x00, 0xbc, 0x10, 0x2e, 0x3f,
    0x7d, 0xcf, 0x4d, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
    0x42, 0x60, 0x82
};

它抛出错误的代码只是网站上提到的几行的简单块:

wxMemoryInputStream inStream(Resource::Embedded::android_png, sizeof(Resource::Embedded::android_png));
wxBitmap image(wxImage(inStream, wxBITMAP_TYPE_PNG));

此外,如果它可以帮助...我正在运行 ActiveState Perl 分发,特别是 5.18.2.1802 版本带有Windows 8.1的64位AMD机器。我对ActiveState Perl的文件处理实现有很强的怀疑,但如果有人有时间帮助我,则需要专家咨询。我会非常感激的。

2 个答案:

答案 0 :(得分:1)

在Perl脚本中使用三参数open。然后,您可以添加:raw图层:

open FILE, '<:raw', $png or die "Cannot read: ${png}: $!\n";

答案 1 :(得分:0)

问题解决了!问题在于CPP代码,特别是在成员变量初始化中。抱歉打扰!