I am trying to get a dialog box [import] to launch from another dialog box [baseline].
I am including the required “.h” files however I am simply not able to create an instance of the import class. The error I get is this:
Error 1 error C2146: syntax error : missing ';' before identifier 'iDlg' h:\shaunak\projects\sar_ccd\sar_ccd\baseline.h 202 1 Sar_CCD
The line of code that causes this [baseline.h]:
#include "Markup.h"
#include<stdio.h>
#include<math.h>
#include "baseline_func.h"
#include "resource.h"
#include "Functions.h"
#include <stdlib.h>
#include "Sar_CCDDoc.h"
#include "Sar_CCDView.h"
#include <vector>
#include "MemAlloc.h"
#include "ReadFiles.h"
#include<vector>
#include<map>
#include "afxwin.h"
#include "import.h"
#include "Geocode.h"
**<SNIP: Taking out the irrelevant lines>**
afx_msg void OnDestroy();
virtual void PostNcDestroy();
afx_msg void OnBnClickedNxtBase();
CButton nextBaseline;
import iDlg; //doesnt work!
CGeocoding cx; //works!!!
};
However, if I create and instance of another class [Geocoding] using the same sysntax like so, it works fine:
#include "Geocoding.h"
CGeocoding cx;
Please help me figure out why.
Full code:
baseline.h: http://freetexthost.com/on06wref6c
import.h: http://freetexthost.com/x4e4dkwrve
In Visual Studio there is a keyword import or #import rather used to import a COM DLL and is used for other things as well. I guess you are experiencing a name collision there.
In order to get around it place your class import in a
namespacethen when you use it
that should solve the issue, although renaming it to something else than “import” would be the better way to go.