查看: 8441|回复: 9

osg3.2+qt5.2+vs2012的编译问题

[复制链接]

该用户从未签到

发表于 2014-1-27 21:10:22 | 显示全部楼层 |阅读模式
由于项目需要,需要开发64位程序,下载了osg3.2、qt5.2的64位版,在vs2012中编译osgqt时,出现这个错误:
2>------ Build started: Project: osgQt, Configuration: Debug x64 ------
2>Build started 2014/1/27 21:06:43.
2>InitializeBuildStatus:
2>  Touching "osgQt.dir\Debug\osgQt.unsuccessfulbuild".
2>CustomBuild:
2>  Building Custom Rule D:/OpenSource/OSG/OpenSceneGraph-3.2.0/src/osgQt/CMakeLists.txt
2>  CMake does not need to re-run because D:\OpenSource\OSG\OpenSceneGraph-3.2.0\build\src\osgQt\CMakeFiles\generate.stamp is up-to-date.
2>  Generating __/__/include/osgQt/moc_QGraphicsViewAdapter.cpp
2>  moc: Too many input files specified
2>  Usage: D:\OpenSource\qt\qt5.2.0\5.2.0\msvc2012_64\bin\moc.exe [options] [header-file] [@option-file]
2>  Qt Meta Object Compiler version 67 (Qt 5.2.0)
2>  
2>  Options:
2>    -?, -h, --help           Displays this help.
2>    -v, --version            Displays version information.
2>    -o <file>                Write output to file rather than stdout.
2>    -I <dir>                 Add dir to the include path for header files.
2>    -F <framework>           Add Mac framework to the include path for header fil
2>                             es.
2>    -E                       Preprocess only; do not generate meta object code.
2>    -D <macro[=def]>         Define macro, with optional definition.
2>    -U <macro>               Undefine macro.
2>    -M <key=value>           Add key/value pair to plugin meta data
2>    -i                       Do not generate an #include statement.
2>    -p <path>                Path prefix for included file.
2>    -f <file>                Force #include [optional <file>] (overwrite default)
2>                             .
2>    -b <file>                Prepend #include <file> (preserve default include).
2>    -n <which>               Do not display notes (-nn) or warnings (-nw). Compat
2>                             ibility option.
2>    --no-notes               Do not display notes.
2>    --no-warnings            Do not display warnings (implies --no-notes).
2>    --ignore-option-clashes  Ignore all options that conflict with compilers, lik
2>                             e -pthread conflicting with moc's -p option.
2>  
2>  Arguments:
2>    [header-file]            Header file to read from, otherwise stdin.
2>    [@option-file]           Read additional options from option-file.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(172,5): error MSB6006: "cmd.exe" exited with code 1.

请问有人遇到过这个情况么?

该用户从未签到

 楼主| 发表于 2014-1-27 21:11:01 | 显示全部楼层
qt和osg的安装目录中都没有空格以及中文

该用户从未签到

发表于 2014-1-31 14:30:23 | 显示全部楼层
本帖最后由 乖o就一下 于 2014-1-31 14:39 编辑

这个我解决了,额  也布吉岛算不解决  命令行运行qt/bin目录  下的moc   ,moc QGraphicsViewAdapter ,然后cmd框内会出现4个函数 还有一堆头文件  把这些copy到osg源文件的QGraphicsViewAdapter.cpp中。  第二  打开/src/osgQt/CMakeLists.txt 定位moc,我现在没这个文件  不知道是哪行  大概就是要运行moc的那句  给屏蔽掉  这样就可以了  编译吧。
(也可以先做第二步,屏蔽掉后直接编译会发现有4个无法识别的函数,然后你会惊奇的发现正是第一步中生成的那四个函数。cmake中用moc本来是要generate出moc_QGraphicsViewAdapter.cpp的,但是不知道是不是写法不正确,所以提示2>  moc: Too many input files specified moc指定过多文件)

可能说的不太清楚  自己研究一下哈。

有了更简单的解决方法后通知一下下。嘿嘿

刚刚看了一下  是这么写的
IF ( Qt5Widgets_FOUND )
    QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-fosgQt/QGraphicsViewAdapter" )
ELSE()
    QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
你的是不是这么写的:
IF ( Qt5Widgets_FOUND )
    QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
ELSE()
    QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )

改成上面那种写法试试,还不行的话就 用我说的方法吧,加个“#”屏蔽掉,或者直接删掉
IF ( Qt5Widgets_FOUND )
#    QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
ELSE()
    QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )

该用户从未签到

 楼主| 发表于 2014-2-7 14:34:33 | 显示全部楼层
乖o就一下 发表于 2014-1-31 14:30
这个我解决了,额  也布吉岛算不解决  命令行运行qt/bin目录  下的moc   ,moc QGraphicsViewAdapter ,然 ...

非常感谢,用的第二种方法,果然成功了

该用户从未签到

发表于 2014-2-14 13:52:45 | 显示全部楼层
GoldFisher 发表于 2014-2-7 14:34
非常感谢,用的第二种方法,果然成功了

这个吗?   QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-fosgQt/QGraphicsViewAdapter" )


还是我的那个很麻烦很麻烦的方法?

该用户从未签到

 楼主| 发表于 2014-2-18 11:08:00 | 显示全部楼层
对,就是QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-fosgQt/QGraphicsViewAdapter" ) 这个

该用户从未签到

 楼主| 发表于 2014-2-18 11:08:13 | 显示全部楼层
乖o就一下 发表于 2014-2-14 13:52
这个吗?   QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-fosgQt/QGraphicsViewAdapter" )


...


对,就是QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-fosgQt/QGraphicsViewAdapter" ) 这个

该用户从未签到

发表于 2014-2-18 17:52:51 | 显示全部楼层
GoldFisher 发表于 2014-2-18 11:08
对,就是QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-fosgQt/QGraphicsViewAdapter" ) 这个

我觉得就是,当时就没联想到是路径的问题,整个源码中都需要改,这里愣是没联系起来,纠结

该用户从未签到

发表于 2014-9-15 08:55:38 | 显示全部楼层
请问楼主,我现在在编译osg3.3.1和qt5.3.1请教一下cmake的时候qt那些库的对应关系是什么,我发现有些库根本就找不到
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表