473,395 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

stupid question? CStrings are killin' me.

raz
Greetings all.

I apologize for what is almost certainly a stupid question, but I
can't figure this out, and have no more time for head bashing...
The short version: what is the appropriate include file to define the
CString type in an MFC based app?

The longer version:

I have a Windows App, in MFC and am trying to use CStrings in a class:

class foo
{
foo();
~foo();

public:
CString m_path;

void setFileName (CString name);

<etc>
}

but when compiling it, I get a boatload of compiler errors because
CString is apparently unknown as type.
c:\DNA\app\BDTS\BDTS\BDTS\FileSet.h(32): error C2146: syntax error :
missing ';' before identifier 'm_path'
If I include "stdafx.h" it will compile, but then later files in the
project fail to compile because WINDOWS is already defined.

I have tried #include <atlstr.h> which sort of works, but fails at
link time
and <cstringt.h> which does no good.

This has *got* to be simple and stupid (on my part), but I don't get
it...

Any help appreciated!

-raz.
Jul 22 '05 #1
5 3114

"raz" <ra*@poetworld.net> wrote in message
news:fa*************************@posting.google.co m...
Greetings all.

I apologize for what is almost certainly a stupid question, but I
can't figure this out, and have no more time for head bashing...
The short version: what is the appropriate include file to define the
CString type in an MFC based app?


CStrings are not part of the standard C++ language, so are off topic here.
Please ask again in a Windows programming group such as
news:comp.os.ms-windows.programmer.tools.mfc

(I would suggest just searching through the headers files for the one that
contains the CString definition, but I know MS headers too well to know that
won't necessarily give you the right answer)

john
Jul 22 '05 #2

"raz" <ra*@poetworld.net> wrote in message
news:fa*************************@posting.google.co m...
Greetings all.

I apologize for what is almost certainly a stupid question, but I
can't figure this out, and have no more time for head bashing...
The short version: what is the appropriate include file to define the
CString type in an MFC based app?

The longer version:


Hey standard C++ doesn't know of class CString at all. having said that i think
it's <afx.h>that you need to include, IIRC.
Jul 22 '05 #3
raz wrote:
Greetings all.

I apologize for what is almost certainly a stupid question, but I
can't figure this out, and have no more time for head bashing...
The short version: what is the appropriate include file to define the
CString type in an MFC based app?

<snip>

I think it's <afxwin.h> or <afx.h>, but MFC is not topical here (only
standard C++ is). If those don't work, try asking in
microsoft.public.vc.mfc.

- Pete


Jul 22 '05 #4

"raz" <ra*@poetworld.net> schrieb im Newsbeitrag
news:fa*************************@posting.google.co m...
Greetings all.

I apologize for what is almost certainly a stupid question, but I
can't figure this out, and have no more time for head bashing...
The short version: what is the appropriate include file to define the CString type in an MFC based app?

The longer version:

I have a Windows App, in MFC and am trying to use CStrings in a class:
class foo
{
foo();
~foo();

public:
CString m_path;

void setFileName (CString name);

<etc>
}

but when compiling it, I get a boatload of compiler errors because
CString is apparently unknown as type.
c:\DNA\app\BDTS\BDTS\BDTS\FileSet.h(32): error C2146: syntax error :
missing ';' before identifier 'm_path'
If I include "stdafx.h" it will compile, but then later files in the
project fail to compile because WINDOWS is already defined.

I have tried #include <atlstr.h> which sort of works, but fails at
link time
and <cstringt.h> which does no good.

This has *got* to be simple and stupid (on my part), but I don't get
it...

Any help appreciated!

-raz.


Visual Studio 6.x I suggest. From the project options, Compiler,
Preprocessor add ".\" as an include path. The stdafx.h your compiler
find might be from a dos-program you wrote before.

HTH,
-Gernot

Jul 22 '05 #5
raz
Apologies to all for the off-topic post.

I thought it may be off-topic, but a quick scan of articles looked
like MS specific questions were applicable. Sorry.

FWIW: I solved the problem, but could not remove the post. Thanks
everyone for the help and the gentle indicators that I was
inappropriate.

Thanks!

-raz
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
2
by: Ron Weldy | last post by:
I read that you don't need .cs files to deploy but I suppose if you are trying to reconstruct someone's work, you will need these files. Is that correct?
3
by: rroman | last post by:
I have a very simple form, takes information from the user, updates a SQL database, now I just want to redirect to a "Thank You For Your Time" web page within the same bowser. ASP. NET VB
6
by: Adam Smith | last post by:
I have posted this and similar questions repeatedly and can't even raise a single response. I am being led to believe that this then 'Must be a stupid question' although people say that there is no...
3
by: nebiyou1 | last post by:
I am trying to implement a simple memory pooling (simple segregated storage) for character strings (char*) of fixed size. I am running into some issues, however. Here is an oversimplified...
15
by: RAB | last post by:
I am programming in the palm environment using C++ and am stuck. I have created an char array: const char MyArray = { {"string1"}, {"string2"}, .... {"string50"} }
2
by: Sean F. Aitken | last post by:
Good afternoon, We have an app that uses a CMap with CString types for values and accepts LPCSTR as the parameter. The object being created is on the heap (created dynamically). A leak detector...
2
by: Lynx101 | last post by:
Hi, Is this a stupid question? Senario: Two tables linked together with an ID number. Question: When using a combo box, which refences another table by indexed autonumber, is there a way to...
9
by: Alec | last post by:
Sorry guys, stupid question.... Am no programming expert and have only just started using php for creating dynamic news pages. Then I see a dynamic website without the php extension. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.