进程终止状态1
我正在处理code :: blocks 10.05,我想在c/C++中读取一个TIFF图像文件。为此,我使用LibTiff库,因此我将tiffio.h作为头文件。现在,当我编译,我得到一个错误“的过程与状态1.终止,我也给给链接库的完整路径进程终止状态1
整个生成日志说:
链接控制台可执行文件:BIN \发布\ tifff.exe
的mingw32-G ++ EXE:E:\ Image:没有这样的文件或目录
的mingw32-G ++ EXE:变换\图书馆\ tifflib \库\的libtiff:没有这样的文件或目录
进程以状态1结束(0分钟s,8秒) 0错误,0警告
鉴于您提供的输出,它看起来就像@ gcbenison所说的链接程序,并没有发现libtiff。更重要的是,鉴于它显示了两行输出,我假设你的libtiff库位于“E:\ Image Transforms \ Libraries \ tifflib \ libs \ libtiff”中,对吧?
嗯,Code :: Blocks doesn't seem to like带空格的路径。因此,尝试将“Image Transforms”重命名为“Image_Transforms”,更正Code :: Blocks中的库路径并重试。
编辑:阐述了答案
同时,一定要确保这样你就可以编译的libtiff库。我从GNUwin32项目下载了libtiff 3.8.2-1.exe进行测试,并且工作完美无瑕。尝试执行以下操作来构建使用libtiff的最低限度工作的程序:
- 在C:\ GnuWin32中安装上述libtiff库。安装完成后,你会在该目录下有很多目录,包括bin,contrib,doc,include,lib等等。
- 在Code :: Blocks中创建一个新的控制台应用程序项目;
- Tell Code :: Blocks它是一个C程序;
- 创建项目后,点击您的项目,然后点击“Build options ...”,访问“Build options”对话框;
- 在“链接器设置”选项卡的“链接库”框架中,单击“添加”并添加libtiff.dll.a。如果你在C:\ GnuWin32中安装了libtiff,你想要的库将是C:\ GnuWin32 \ lib \ libtiff.dll.a;
- 在“搜索目录”选项卡,你会:
- 选择“编译器”选项卡,并添加“C:\的GnuWin32 \包括”给它;
- 选择“链接器”选项卡并添加“C:\ GnuWin32 \ lib”;
- 在“构建选项”对话框中单击“确定”,因为现在一切都应该是确定的。
您可以尝试立即构建您的程序,看看构建是否成功。我用的第一个例子中Graphics programming with libtiff, Part 2作为测试程序:
#include <stdio.h>
#include <stdlib.h>
#include <tiffio.h>
int main()
{
TIFF *output;
uint32 width, height;
char *raster;
printf("Trying to write TIFF...\n");
if((output = TIFFOpen("output.tif", "w")) == NULL){
fprintf(stderr, "Could not open outgoing image\n");
exit(42);
}
width = 42;
height = 42;
if((raster = (char *) malloc(sizeof(char) * width * height * 3)) == NULL){
fprintf(stderr, "Could not allocate enough memory\n");
exit(42);
}
TIFFSetField(output, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField(output, TIFFTAG_IMAGELENGTH, height);
TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);
TIFFSetField(output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
TIFFSetField(output, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(output, TIFFTAG_SAMPLESPERPIXEL, 3);
if(TIFFWriteEncodedStrip(output, 0, raster, width * height * 3) == 0){
fprintf(stderr, "Could not write image\n");
exit(42);
}
TIFFClose(output);
printf("TIFF written successfully.\n");
return 0;
}
现在尝试建立(按Ctrl + F9)和运行程序。我遵循上面提到的步骤,并让我的程序编译和工作。
对于构建,代码:: Blocks的输出是(我叫我的程序的libtiff):
-------------- Build: Debug in libtiff ---------------
Compiling: main.c
Linking console executable: bin\Debug\libtiff.exe
Output size is 27,93 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
对于运行,它的输出:
Trying to write TIFF...
TIFF written successfully.
Process returned 0 (0x0) execution time : 0.125 s
Press any key to continue.
Thxx很多先生..我已将其更改为image_transforms,但仍显示相同的错误。在为一个未知的库设置上述路径之后,在project \ properties \ libraries中,当我编译它时,会出现libfinder错误,提示“没有找到库的配置并要求我去检测对话框。现在,当我去对话框,它显示了我缺少上述路径的定义,并给出了一个选项来下载这个缺失的定义,但是当我尝试下载这个代码::块没有响应.. :(:(请帮助我...有人请回应这个查询... thx预先.. – Kushal
我编辑了答案,试图帮助你多一点。 – renatoc
Thxx很多先生它已经gr8的帮助。遵循所有的步骤,因为你提到和实施乌尔示例code.Its构建是成功的bt我运行它,它给出了一个错误,说“程序无法启动bcoz libtiff3.dll丢失”和生成日志说“检查存在:E:\ CBoutput \ Tiffs \ bin \ Debug \ Tiffs.exe 执行: “C:\ Program Files(x86)\ CodeBlocks/cb_console_runner.exe“E:\ CBoutput \ Tiffs \ bin \ Debug \ Tiffs.exe”(位于E:\ CBoutput \ Tiffs \中) 过程以状态-1073741510(2分20秒)终止 “&再次thx很多帮助我out.for最后一次绝对帮助我解决这个问题。 – Kushal
链接器没有找到库。目录树中的文件“tifflib \ libs \ libtiff”在哪里? – gcbenison
Thx很多响应我的查询,我的文件是在E:\ Image_Transforms \ Libraries \ tifflib \ libs \ libtiff ...和它的一个库包含头文件..请帮助我... – Kushal