此声明没有存储类或类型说明符[OSG]

前言

今天从书上抄来的代码,抄好后运行出错,一直以为我在代码抄写的过程中出了问题,或者书上的代码本身有问题。错误截图如下:

解决

书中原代码为

#include <osgdb/ReadFile>
#include <osgViewer/Viewer>
#include <osg/Group>
#include <osgFX/Scribe>
#include <osgGA/GUIEventHandler>
#include <osgUtil/LineSegmentIntersector>

在首行添加

#include <Windows.h>
注意是在原代码的前头添加,注意#include的顺序

posted @ 2020-04-13 19:17  bigeo  阅读(949)  评论(0)    收藏  举报