c++基础太弱,纠正一下,在PRO中使用包含目录就可以使用<>,将下载的opencascade文件通过make编译和安装,添加引用就可以了。
如果你依然对以下没用的操作感兴趣,请继续....
使用PYTHON转换一下包含的文件格式,OCC默认使用的 <XXXX.hxx> qt不能识别,需要转换为 "xxxx.hxx"
补充:在QT的pro文件里添加 INCLUDE += /home/XXXX/Documents/opencascade-7.0.0/src/XXXX ,在头文件里引用即可 比如 #include <gp_Pnt.hxx>
有知道怎么设置识别的请告诉我 谢谢
以下是python代码,从occ文件夹获取文件到qt程序下的目录
实现功能:指定需要使用的occ源代码文件,从源代码目录拷贝到指定文件夹,并将所有源代码头文件包含的文件也拷贝过来,同事将 #include <xxxx.hxx> 改为 #include "xxxx.hxx"
基本思路
1.设置默认需要的文件们,从源文件夹拷贝过来
2.将已经拷贝过来的文件添加列表sonsList
2.循环读取默认文件,将自己从list清除,检测#include <xxxx.hxx>
3.替换为 "xxxx.hxx"并记录到sonsList
4.从sonsList读取顶部的记录,递归查找
5.查找下一个默认定义的文件
#coding=utf-8
#get the file from occ
# copy the file and change its header include
import os
import os.path
import shutil
import re
def findStr(fml_s):
match = re.search('(^#include\s+)<(.*\.(hxx|lxx))>', fml_s)
if match:
ms = match.group()
fline = chStr(fml_s)
headername=match.group(2)
print('find' ,match.group(2))
print('find in line',fline)
return True, fml_s, headername
else:
return False, fml_s, ''
def chStr(fml_s):
fml_s = re.sub('<','"occ_math/',fml_s)
fml_s=re.sub('&