QT之导入BasicExcel

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_25034451/article/details/79370337

Qxlsx不支持xls格式,其他的不知道怎么用,所以选择了BasicExcel,导入后出现以下问题

F:\Study\c++\study\BasicExcel\BasicExcel.cpp:889: error: 'strlen' was not declared in this scope
  size_t filenameLength = strlen(filename);
                                         ^

猜测是strlen的源文件没有导入,尝试导入#include,结果还是不行,最后找到一个文章《http://blog.csdn.net/bog2000/article/details/5960594》,最终解决

协议分发程序程序在公司机器上编译运行良好,而我在我的虚拟机上编译,却出下如下错误:
msg.cpp:3101: error: ‘strcpy’ was not declared in this scope

查看源码已经包含了相关头文件及命名空间,如下:


而且程序中使用的map, queue,list等都能正确使用,唯独string不能使用。

而且通过#find ./ -name string –print 也能以现在/usr/include/c++/4.4.0目录下存在string文件。
如何解决?




分析:



#include <string.h> 在c++中,是指标准化以前的标准c库中的字char*字符串处理函数
#include <string>中在1988年标准化以后,c++中含的STL的string容器
#include <cstring> 是在1988年标准化以后,<string.h>的演变。
总之你记住一句话:<string>与<string.h>是完全不同的两个东西。




========================================================================

用历史来让你更理解吧!!!





C语言是1972年由美国贝尔实验室的D.M.Ritchie研制成功。C语言的头文件包含格式如下:
#include <stdio.h> 
#include <string.h>
#include <math.h>

20世纪80年代初,Bjarne Stroustrup博士及其同事在C语言的基础上成功研发出C++语言。C++是由C发展来的,与C兼容,是对C的扩展,或者说是C的超集(当时的名称也不叫c++, 而叫C with class)。因为最初的C++的头文件包含格式自然而然与C保持了一致:
// (标准化以前c库)
#include <stdio.h>
#include <string.h>
#include <math.h>

// 标准化以前的标准c++库
#include <iostream.h>


1988年,对C++进行了标准化。在这次行动中,把标准C++库的组件放在一个名位stdnamespace里面,同时为了区别c库,也产生了如下名称:
// 标准化以后的标准C库
#include <cstdio>
#include <cstring>
#include <cmath>
// 标准化以后的标准c++库
#include <iostream>


1995-2000年,出现并开始大量使用标准模板库STL及Boost库
#include <map>
#include <string>
#include <vector>

猜你喜欢

转载自blog.csdn.net/qq_25034451/article/details/79370337