MFC에 콘솔 프로그램 인클루드시 에러 발생

punxism의 이미지

다시 한번 설명하면

파서 제네레이터라는 프로그램을 이용해서 파서를 만들었습니다.
그것을 MFC의 인터페이스와 통합하는 과정에서 에러가 발생했습니다.

파서 헤더 파일을 인클루드하니 에러가 다더군요.

에러의 종류는 MFC의 뷰나 도규멘테이션, 프레임에서

syntax error : 'constant'
c:\documents and settings\punxism\바탕 화면\통합작업1차완료\gochi_studio-1212-0306\mainfrm.h(92) : error C2238: unexpected token(s) preceding ';'

이런 종류의 에러가 많이 발생합니다.

초보 프로그래머 입니다. 도움을 부탁 드립니다.

chadr의 이미지

Quote:
syntax error : 'constant'
c:\documents and settings\punxism\바탕 화면\통합작업1차완료\gochi_studio-1212-0306\mainfrm.h(92) : error C2238: unexpected token(s) preceding ';'

위의 에러에 해당하는 헤더 파일을 올려주시면 더 쉽게 도움을 드릴수 있겠습니다:)

-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.

punxism의 이미지

// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__7DC8C5A5_9624_45E9_9B00_E8BB66F6493B__INCLUDED_)
#define AFX_MAINFRM_H__7DC8C5A5_9624_45E9_9B00_E8BB66F6493B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include ".\GochiParser\GOCHI_Parser.h"

//Workspace
class CSolutionView;
class CClassView;
class CPropertyView;
class CCompileOutputView;
class CLoadingDlg;

class CMainFrame : public CXTPMDIFrameWnd
{
	DECLARE_DYNAMIC(CMainFrame)
public:
	CMainFrame();

public:
	//Multiple Docking panes
	CXTPDockingPaneManager m_paneManager;


// Operations
public:
	//Multiple Docking panes
	CXTPDockingPaneManager* GetDockingPaneManager() {
		return &m_paneManager;
	}
	
	void OnStartLoading();
	void OnEndLoading();

// Attributes
public:
	
	//Represents a tapped WorkingSpace
	CXTPTabClientWnd m_MTIClientWnd;

	//Multiple a pane's layouts
	CXTPDockingPaneLayout* m_pPreviewLayout;

	//Property Grid (similer to .net Property)
	CXTPPropertyGrid m_wndPropertyGrid;

	//Tree Control
	CTreeCtrl m_wndClassView;
	CTreeCtrl m_wndSolutionView;
	CTreeCtrl m_wndResourceView;

	//Edit Control
	CEdit m_wndOutput;
	CEdit m_informationView;

	//Font 
	CFont m_fontOutput;

	//Image List
	CImageList m_ilClassView;
	CImageList m_ilSolutionView;
	CImageList m_ilResourceView;

	//view
	CSolutionView * m_pSolutions;
	CClassView	  * m_pClass;
	CPropertyView * m_pProperty;
	CCompileOutputView * m_pOutput;
	
	//LoadingDlg
	CLoadingDlg   * m_pLoadingDlg;

// Operations
public:

	//Create View 
	CWnd* CreatePropertyView();
	CWnd* CreateClassView();
	CWnd* CreateSolutionView();
	CWnd* CreateResourceView();
	CWnd* CreateOutputView();
	CWnd* CreateInformationOutput();
	
	
	BOOL ShowWindowEx(int nCmdShow);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainFrame)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState);
	//}}AFX_VIRTUAL

// Implementation
public:
	void OpenSolutionFile(char * name);
	virtual ~CMainFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	afx_msg void OnCustomize();
	afx_msg int OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl);

	afx_msg void OnEditState(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnUpdateEditState(CCmdUI* pCmdUI);

	int m_nState;
	

protected:  // control bar embedded members
	CXTPStatusBar  m_wndStatusBar;
	//CToolBar    m_wndToolBar;

// Generated message map functions
protected:
	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnClose();
	afx_msg void OnSelchangedTreeSolution(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDblclkTreeSolution(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnTest();
	//}}AFX_MSG
	afx_msg void OnEmptyCommand();
	afx_msg void OnEmptyCommandRange(UINT);
	afx_msg void OnShowView(UINT);
	LRESULT OnDockingPaneNotify(WPARAM wParam, LPARAM lParam);

	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MAINFRM_H__7DC8C5A5_9624_45E9_9B00_E8BB66F6493B__INCLUDED_)


헤더 파일을 인클루드 하는 헤더구요.

밑에는 인클루드 되는 (콘솔에서 만든)헤더 입니다.

// GOCHI_Parser.h: interface for the CGOCHI_Parser class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GOCHI_PARSER_H__BE0889F8_4EDA_487B_866D_6F163C6FB804__INCLUDED_)
#define AFX_GOCHI_PARSER_H__BE0889F8_4EDA_487B_866D_6F163C6FB804__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "cppLexer.h"
#include "SyntaxAnalysis.h"
#include <fstream>
#include <iostream>

using namespace std;

class CGOCHI_Parser  
{
public:
	CGOCHI_Parser();
	virtual ~CGOCHI_Parser();

	CNameManager nameManager;

private:
	cppLexer lexer;
	SyntaxAnalysis parser;
	
	string			curFileName;
	unsigned int 	realLineNo;

	vector<string> parsedFiles;		// 파싱했던 파일 목록을 보관한다.
									// 프로그램 최초에 프로젝트를 로드 했을 때 목록이 저장되며,
									// 이 벡터의 인덱스와 같은 인덱스로 해당 파일에 존재하는 
									// Name들을 Access 할 수 있다.

public:
	void debug();
	bool Parsing(char* PathName, char* Filename);
};

#endif // !defined(AFX_GOCHI_PARSER_H__BE0889F8_4EDA_487B_866D_6F163C6FB804__INCLUDED_)
punxism의 이미지

분명히 따로 컴파일 시키면 잘됩니다.
인클루드 시키지 않고 빌드 하면 에러 안나고요.

하지만 MFC 프레임에 parser 헤더 파일을 인크루드 시키면 에러가 납니다.

파서로는 parser Generator을 사용하고 있는데.
라이브러리 탓인지 전혀 모르겟군요..

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.