【发布时间】:2014-09-08 12:59:49
【问题描述】:
我的 IDE 是 MS Visual Studio C++ 2013,我使用 Boost Library 进行文件系统操作。 我写了这段代码:
// BoostFileSystem.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <boost\filesystem.hpp>
using namespace boost::filesystem;
using namespace std;
int main()
{
cout << "File Size: " << endl;
cout << file_size("as.jpg");
return 0;
}
它抛出错误。错误是:
1>------ Build started: Project: BoostFileSystem, Configuration: Debug Win32 ------
1> BoostFileSystem.cpp
1> LINK : C:\...\visual studio 2013\Projects\BoostFileSystem\Debug\BoostFileSystem.exe not found or not built by the last incremental link; performing full link
1> BoostFileSystem.vcxproj -> C:\..\documents\visual studio 2013\Projects\BoostFileSystem\Debug\BoostFileSystem.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
'as.jpg' 也包含在 Resources 文件夹中。当我删除这一行时:
file_size("as.jpg");
不会抛出错误。还要记住,编译器没有报告失败。
有什么问题?实在想不通。
因为当我删除file_size() 行时,程序可以完全运行并且还会在屏幕上打印文本(“文件大小:”)。当按原样运行时,编译器不会抛出任何错误,但没有文本(即使file_size() 之前的行)不是打印机,并且在控制台中会打印以下内容(也已输出到错误区域粘贴在上面):
更新:
这是控制台窗口中显示的错误:
The system cannot find the file C:\Users\Ali\do
ts\BoostFileSystem\Debug\BoostFileSystem.exe.
【问题讨论】:
-
我在您粘贴的输出中没有看到错误。
-
我很困惑,你的编译器说
Build: 1 succeeded, 0 failed,但你说有错误? -
请记住,Visual Studio 中的默认文件夹是包含解决方案文件的文件夹,而不是资源文件夹。同样正如其他人所提到的,您的问题没有显示错误。关于执行完整链接的那一点不是错误。
-
有错误,我没有说失败,我说做某事时出错。我解释说“某事”
-
让我在我的问题中添加另一个,请稍候