[vtkusers] error c1189 ?? help
Jérôme
jerome.velut at gmail.com
Mon Aug 17 03:33:44 EDT 2009
Hi,
As far as I know, stdafx is an include file that defines pre-compiled header
for ms windows applications. Hum, maybe "PCH" means "pre-compiled header".
Your error message indicates error at line 1 where you have comment
character. This is weird. It seems that you have to include files in a order
that has its importance. Maybe you can try to include "stdafx.h" first ?
Good luck
Jerome
2009/8/17 salih halil sonmez <salihhalilsonmez at gmail.com>
> hi everyone;
> I am trying to compile simple vtk samples. Then, I faced with error like:
>
> Error 1 fatal error C1189: #error : include 'stdafx.h' before
> including this file for PCH
>
> How can I deal with this problem? can anyone help?
>
> Here is the sample code:
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> #include "vtkSDI.h"
>
> #include "vtkSDIDoc.h"
> #include "vtkSDIView.h"
>
> #include "vtkCallbackCommand.h"
> #include "stdafx.h"
> #ifdef _DEBUG
> #define new DEBUG_NEW
> #endif
>
>
> // CvtkSDIView
>
> IMPLEMENT_DYNCREATE(CvtkSDIView, CView)
>
> BEGIN_MESSAGE_MAP(CvtkSDIView, CView)
> // Standard printing commands
> ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
> ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
> ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
> ON_WM_CREATE()
> ON_WM_DESTROY()
> ON_WM_ERASEBKGND()
> ON_WM_SIZE()
> END_MESSAGE_MAP()
>
> // CvtkSDIView construction/destruction
>
> CvtkSDIView::CvtkSDIView()
> {
> this->pvtkMFCWindow = NULL;
>
> // Create the the renderer, window and interactor objects.
> this->pvtkRenderer = vtkRenderer::New();
> }
>
> CvtkSDIView::~CvtkSDIView()
> {
> // delete generic vtk window
> if (this->pvtkMFCWindow) delete this->pvtkMFCWindow;
> }
>
> void CvtkSDIView::OnDraw(CDC* pDC)
> {
> CvtkSDIDoc* pDoc = GetDocument();
> ASSERT_VALID(pDoc);
>
> if (this->pvtkMFCWindow)
> {
> if (pDC->IsPrinting())
> this->pvtkMFCWindow->DrawDC(pDC);
> }
> }
>
>
> // CvtkSDIView printing
>
> BOOL CvtkSDIView::OnPreparePrinting(CPrintInfo* pInfo)
> {
> // default preparation
> return DoPreparePrinting(pInfo);
> }
>
> void CvtkSDIView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
> {
> // TODO: add extra initialization before printing
> }
>
> void CvtkSDIView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
> {
> // TODO: add cleanup after printing
> }
>
>
> // CvtkSDIView diagnostics
>
> #ifdef _DEBUG
> void CvtkSDIView::AssertValid() const
> {
> CView::AssertValid();
> }
>
> void CvtkSDIView::Dump(CDumpContext& dc) const
> {
> CView::Dump(dc);
> }
>
> CvtkSDIDoc* CvtkSDIView::GetDocument() const // non-debug version is inline
> {
> ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CvtkSDIDoc)));
> return (CvtkSDIDoc*)m_pDocument;
> }
> #endif //_DEBUG
>
>
> // CvtkSDIView message handlers
>
> int CvtkSDIView::OnCreate(LPCREATESTRUCT lpCreateStruct)
> {
> if (CView::OnCreate(lpCreateStruct) == -1)
> return -1;
>
> return 0;
> }
>
> void CvtkSDIView::OnDestroy()
> {
> // Delete the the renderer, window and interactor objects.
> if (this->pvtkRenderer) this->pvtkRenderer->Delete();
>
> // destroy base
> CView::OnDestroy();
> }
>
> BOOL CvtkSDIView::OnEraseBkgnd(CDC* pDC)
> {
> return TRUE;
> }
>
> void CvtkSDIView::OnSize(UINT nType, int cx, int cy)
> {
> CView::OnSize(nType, cx, cy);
>
> if (this->pvtkMFCWindow)
> this->pvtkMFCWindow->MoveWindow(0, 0, cx, cy);
> }
>
> static void handle_double_click(vtkObject* obj, unsigned long,
> void*, void*)
> {
> vtkRenderWindowInteractor* iren =
> vtkRenderWindowInteractor::SafeDownCast(obj);
> if(iren && iren->GetRepeatCount())
> {
> AfxMessageBox("Double Click");
> }
> }
>
> void CvtkSDIView::OnInitialUpdate()
> {
> CView::OnInitialUpdate();
>
> if (this->pvtkMFCWindow) delete this->pvtkMFCWindow;
> this->pvtkMFCWindow = new vtkMFCWindow(this);
>
> this->pvtkMFCWindow->GetRenderWindow()->AddRenderer(this->pvtkRenderer);
>
> // get double click events
> vtkCallbackCommand* callback = vtkCallbackCommand::New();
> callback->SetCallback(handle_double_click);
>
> this->pvtkMFCWindow->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent,
> callback, 1.0);
> callback->Delete();
>
> }
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>
> So, How can I deal with this problem? can anyone help?
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090817/126f9892/attachment.htm>
More information about the vtkusers
mailing list