From: Jung, William on 15 Jan 2009 20:05 why the following gets error #include <iostream> #include <string.h> #include <string> using std::cout; using std::endl; int main() { CString idle_cmd_on = "aaaa"; } 1>..\..\myCode\string.cpp(21) : error C2065: 'CString' : undeclared identifier
From: Alec S. on 15 Jan 2009 20:47 Jung, William wrote (in news:ganvm4h176g3ep843b9d4l95tqk5voae30(a)4ax.com): > why the following gets error Probably because you haven�t got the header included: #include <afxstr.h>. -- Alec S. news/alec->synetech/cjb/net > > #include <iostream> > #include <string.h> > #include <string> > using std::cout; > using std::endl; > > > int main() { > CString idle_cmd_on = "aaaa"; > } > > \myCode\string.cpp(21) : error C2065: 'CString' : undeclared identifier
From: Jung, William on 15 Jan 2009 21:05 On Thu, 15 Jan 2009 20:47:30 -0500, "Alec S." <nospam(a)127.0.0.1> wrote: >Jung, William wrote (in news:ganvm4h176g3ep843b9d4l95tqk5voae30(a)4ax.com): > >> why the following gets error > >Probably because you haven?t got the header included: > > #include <afxstr.h>. when i include the header, i got another error 1>C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxstr.h(20) : fatal error C1189: #error : afxstr.h can only be used in MFC projects. Use atlstr.h the app is not MFC project, it's only a simple main function #include <iostream> #include <string.h> #include <string> #include <windows.h> #include <afxstr.h> using std::cout; using std::endl; int main() { CString idle_cmd_on = "<s>"; }
From: Igor Tandetnik on 15 Jan 2009 21:12 "Jung, William" <aopiyy001(a)yahoo.com> wrote in message news:3pqvm451m5v1et94j4dlj40u2gamiq35h0(a)4ax.com > 1>C:\Program Files\Microsoft Visual Studio > 8\VC\atlmfc\include\afxstr.h(20) : fatal error C1189: #error : > afxstr.h can only be used in MFC projects. Use atlstr.h So, have you tried atlstr.h instead of afxstr.h? -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
From: Jung, William on 15 Jan 2009 21:20 On Thu, 15 Jan 2009 21:12:09 -0500, "Igor Tandetnik" <itandetnik(a)mvps.org> wrote: >"Jung, William" <aopiyy001(a)yahoo.com> wrote in message >news:3pqvm451m5v1et94j4dlj40u2gamiq35h0(a)4ax.com >> 1>C:\Program Files\Microsoft Visual Studio >> 8\VC\atlmfc\include\afxstr.h(20) : fatal error C1189: #error : >> afxstr.h can only be used in MFC projects. Use atlstr.h > >So, have you tried atlstr.h instead of afxstr.h? this one works thanks! so both atlstr.h + afxstr.h have some CString code?
|
Next
|
Last
Pages: 1 2 Prev: error C3646: 'exception' : unknown override specifier Next: Manifest question! |