osg3.2.0+Qt5.5.0+VS2010的编译问题

来源:互联网 发布:tensorflow图像识别 编辑:程序博客网 时间:2024/04/28 05:14
由于项目需要,需要开发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.

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


这个我解决了,额  也布吉岛算不解决  命令行运行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" ) 


转载地址:http://bbs.osgchina.org/forum.php?mod=viewthread&tid=13202&_dsign=89e9e15a

0 0
原创粉丝点击