473,320 Members | 1,969 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,320 software developers and data experts.

what gives? cstring template issues

In VS 2003, I try creating a new VC7 MFC dll. Accepting all defaults,
before adding ANY code, I get compiler errors out the wazoo having to
do with this CString template. I ran across the same problem in
porting some code over and compiling with the /clr switch and I
resolved that issue by modifying a section of code that was typecasting
a byte to a string (AFTER about a half-day of figuring out the right
compiler options, and then realizing I needed to change them for EVERY
SINGLE SOURCE FILE in the project, which I managed to accomplish with
find/replace in notepad, but only AFTER dancing through hoops). But my
current errors must be in the default project settings, or somewhere
??!! Because I haven't written a single line of source yet.

IJW my AS$ !

TIA

Feb 3 '06 #1
10 1469
I just added a new MFC dll project to a VS2003 solution, accepted the
defaults (no automation, no sockets, using MFC in a shared dll).
everything builds without a problem.
No CString errors or anything.

did you modify your environment or project settings, or anything else?
what are the compiler errors you get?

kind regards,
Bruno.
"dotnetchic" <do********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
In VS 2003, I try creating a new VC7 MFC dll. Accepting all defaults,
before adding ANY code, I get compiler errors out the wazoo having to
do with this CString template. I ran across the same problem in
porting some code over and compiling with the /clr switch and I
resolved that issue by modifying a section of code that was typecasting
a byte to a string (AFTER about a half-day of figuring out the right
compiler options, and then realizing I needed to change them for EVERY
SINGLE SOURCE FILE in the project, which I managed to accomplish with
find/replace in notepad, but only AFTER dancing through hoops). But my
current errors must be in the default project settings, or somewhere
??!! Because I haven't written a single line of source yet.

IJW my AS$ !

TIA

Feb 3 '06 #2
Following the same steps you describe, I get the rather cryptic output
message (several similar):

c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\cstringt.h(868) : error C2143: syntax error :
missing ';' before 'template'

along with many of the following compiler errors (mostly syntax
errors):
C2146, C2252, C2252, C2501, C2653, C2334,
which all revolve around compilation of stdafx.cpp. I haven't changed
any project settings, and nothing looks out of line... ?

Feb 3 '06 #3
Has anyone else had this problem with cstrings / templates? Any
suggestion what I might can try? I'm trying to bring a new project
over to vc++7, or preferrably c#, but I can't seem to make any progress.

Feb 7 '06 #4
Hi,
"dotnetchic" <do********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Has anyone else had this problem with cstrings / templates? Any
suggestion what I might can try? I'm trying to bring a new project
over to vc++7, or preferrably c#, but I can't seem to make any progress.


Could you prehaps post a project that reproduces this behavior?
If you have this problem with a newly created project, then compiling it on
my side should quickly show if the problem is in your project or your
environment.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
Feb 7 '06 #5
Of course! Many thanks for taking a look. I'll send to your e-mail.

-SLC

Feb 7 '06 #6
my lib and include paths are the same as yours above. I am unable to
compare your build log against mine, though...can you send to my e-mail?

Feb 7 '06 #7
dotnetchic wrote:
my lib and include paths are the same as yours above. I am unable to
compare your build log against mine, though...can you send to my
e-mail?


Have you modified the cstringt.h header? Post a snippet of this file around
line 868.

Arnaud
MVP - VC
Feb 7 '06 #8
To my knowledge, cstringt.h has not been modified (at least not by
yours truly). See anything unusual?
#ifndef _MANAGED

This template will compile only for
class SystemString == System::String

template<class SystemString>
CStringT( SystemString * pString ) :
CThisSimpleString( StringTraits::GetDefaultManager() )
{
const wchar_t __pin* psz = PtrToStringChars( pString );
*this = psz;
}
#endif

Feb 7 '06 #9
Hi,
#ifndef _MANAGED in my header, this is #ifdef, not #ifndef
This template will compile only for
class SystemString == System::String

the // comment characters are missing at the start of these 2 lines.

judging by this, your headers are different from what they should be.
In one of your previous posts, you mentioned that you had to manually edit a
lot of files.
maybe you accidently edited the header?

I don't know if there is a good way to repair the headers or not.
if you have to do it by hand, the simplest thing might be to just reinstall
VS.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
Feb 7 '06 #10
Right. The comments are kinda suspicious, huh?

Actually, I had to manually change the BasicRuntimeChecks settings for
each file included in the project, and ended up manually editing the
project file. So my editing was isolated to the one file, not
affecting any headers.

I just changed the directive and everything compiled. Hmmm... Note to
self: keep the boss out of the source files!!

Well, thanks for your help. At least I'm back to square 1 with my code
port. Cheers!

Feb 7 '06 #11

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

Similar topics

35
by: GTO | last post by:
I do not believe that C# is the future of C++. I also do not believe that adding two thousand new library functions to the standard library is the future of C++. But what is the future of C++? Is...
1
by: dave | last post by:
Hi, I would apprecaite the followinghelp; I need to pass a TCHAR * s = foo*.* \0 *h\0" to CString operator, but it will stop reading input at teh first \0, how do I work around this ?? ...
5
by: Paul | last post by:
Hi, Any one knows how to convert CString to LPCWSTR? Please advice, thanks! -P
7
by: storyGerald | last post by:
Usually, people write the program like this: // a very easy example: #include <cstring> int main() { size_t length = strlen("Hello, world!\n"); return 0; }
1
by: Michael Buechel | last post by:
Hi NG, I've copied this from the article Q309801 (http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B309801). ---- schnipp --------- You may receive an LNK2019 error message when you...
4
by: huguogang | last post by:
Just curious, any one know what the 3 part parameter "class CString filename" would mean. The code: int TestFunc(class CString filename) { fopen(filename, "w"); } Compile using Visaul C++,...
4
by: Cactus | last post by:
How to convert unsigned char* to CString: I wrote some function: u_char_ =55; u_char_ =66; u_char_ =77; .........=ii...... Convert_to_CS(u_char_);
4
by: sreenubkaimal | last post by:
Please help me with this.. I have a DLL created in Visual C++ 6.0 ( VS 6.0 ). I am trying to use this DLL in a new wrapper application written using Visual Studio .net 2003 (C++ - MFC). My...
16
by: John Doe | last post by:
Hi, I wrote a small class to enumerate available networks on a smartphone : class CNetwork { public: CNetwork() {}; CNetwork(CString& netName, GUID netguid): _netname(netName),...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.