• 7807阅读
  • 6回复

[讨论]关于dumpcpp 生成的word.h word.cpp 编译出现的奇怪问题 [复制链接]

上一主题 下一主题
离线usethisname
 

只看楼主 倒序阅读 楼主  发表于: 2014-11-24
这两天在整Qt控制Word文档,根据自带的例子outlook,我仿照他生成了word.cpp word.h office.h office.cpp , 但是编译不通过  
例子中的outlook我能编译通过。我的问题就很多,基本如下:
就这个函数,其余的类同:
这个是office.h里面的,红色部分是上面一行的错误

inline int ColorFormat::RGB() const  
//D:\officeSrc\office.h:37807: error: C2143: syntax error : missing ';' before '::'
//office.h(37807) : warning C4003: not enough actual parameters for macro 'RGB'
//d:\officesrc\office.h:37807: error: C2059: syntax error : '::'

//\officesrc\office.h(37808) : error C2143: syntax error : missing ';' before '{'
//\officesrc\office.h:37807: warning: C4091: 'inline ' : ignored on left of 'int' when no variable is declared

{
//D:\\office.h:37807: error: C2589: '(' : illegal token on right side of '::'

//\officeSrc\office.h:37808: error: C2447: '{' : missing function header (old-style formal list?)
//\office.h:37807: error: C2143: syntax error : missing ';' before '::'
//\officeSrc\office.h:37807: error: C2059: syntax error : '::'
//.........................还有十条左右
    QVariant qax_result = property("RGB");
    Q_ASSERT(qax_result.isValid());
    return *(int*)qax_result.constData();
}

问题主要就出在函数的定义头部分,Qt用的VC2010的编译;求大家指教
离线usethisname

只看该作者 1楼 发表于: 2014-11-24
这个问题刚才查了一下,可能是重复定义的原因,我把添加的windows.h去掉就没有了;但是又出现了四个同样的错误,请大家看看,这个是什么原因:

C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\ActiveQt\qaxobject.h:69: error: C2248: 'QObject::QObject' : cannot access private member declared in class 'QObject'
C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\QtCore\qobject.h:465: see declaration of 'QObject::QObject'
C:\Qt\Qt5.3.1\5.3\msvc2010_opengl\include\QtCore\qobject.h:115: see declaration of 'QObject'
This diagnostic occurred in the compiler generated function 'QAxObject::QAxObject(const QAxObject &)'


四个错误都是上面的,指向了QAxObject的类定义结尾出:
};
离线roywillow

只看该作者 2楼 发表于: 2014-11-24
使用这玩意从来没成功过,都是自己去调用dynamicCall之类的
专业维修核潜艇,回收二手航母、二手航天飞机,大修核反应堆,拆洗导弹发动机更换机油,无人侦察机手动挡改自动,航天飞机保养换三滤,飞碟外太空年检 ,各型号导弹加装迎宾踏板,高空作业擦洗卫星表面除尘、打蜡及抛光,东风全系列巡航导弹。并提供原子对撞机。量大从优,有正规发票。
离线usethisname

只看该作者 3楼 发表于: 2014-11-24
  
那我请教你一个问题,你是怎么获取那些属性的,比如你有个字体是黑体5号,怎么获取的?相反的怎么设置呢?
离线usethisname

只看该作者 4楼 发表于: 2014-11-24
现在看到那些生成的html文档中很多属性,用其中的方法获取不了;
比如 文档中:
QFont font

Read this property's value using QObject::property:

    QFont val = object->property("font").toFont();
Set this property' value using QObject::setProperty:
    QFont newValue = ...
    object->setProperty("font", newValue);
Or using the setFont slot.

并没有toFont()这个函数阿?
离线彩阳

只看该作者 5楼 发表于: 2014-11-24
dumpcpp产生的这个类,最好不要动,拿来用就好了
上海Qt开发联盟,热忱地欢迎你的加入!
离线usethisname

只看该作者 6楼 发表于: 2014-11-24
我只动了一个地方,在word.h中添加了office.h这个头文件,因为不添加会有很多未定义的东西。加了之后编译就出错了,就我是上面贴出来的。
我也查了一下,说是继承于QObject类不能构造它。但是我目前没有找到构造的地方,我在没有添加这个头文件之前,我编译是通过了的,加了之后不行。
快速回复
限100 字节
 
上一个 下一个