I'm not sure where should I declare my extern variable. let say is
extern char nbuffer[30];

nbuffer is a global variable, and defined in other source file.

Assuming I have MainDlg.cpp, Dialog1.cpp.
In my Dialog1.cpp

#include "MainDlg.h"
.....
void CDialog1::OnMyok()
{
//here I want to use global variable nbuffer, but got error!!!
GetDlgItemText(IDC_EditBox, nbuffer, 30);
CDialog::OnOK();
}

Then I declared nbuffer at MainDlg.h after the statement, not if it is right way to do.

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

#endif //

extern char nbuffer[30];


But compilation gives me error "nbuffer" Undeclared identifier. Why ? and how to fix it ?