1,105,177 Community Members

_crt_secure_no_warnings

Member Avatar
Frederick2
Posting Whiz
330 posts since Jul 2008
Reputation Points: 189 [?]
Q&As Helped to Solve: 31 [?]
Skill Endorsements: 0 [?]
 
0
 

It seems even if I place

#define _CRT_SECURE_NO_WARNINGS

at the top of my C++ source files, if the warning level is set to 3 or 4 I still get all the warnings. Is this the way it is supposed to be? I like to have my warning levels set fairly high to help me catch stuff, but I'd like to eliminate the strcpy and other stuff that brings up these warnings. Any suggestions?

Member Avatar
Salem
Posting Sage
7,177 posts since Dec 2005
Reputation Points: 5,138 [?]
Q&As Helped to Solve: 970 [?]
Skill Endorsements: 41 [?]
Team Colleague
 
1
 

The best place is project->settings->preprocessor and set the flag there.

Member Avatar
Frederick2
Posting Whiz
330 posts since Jul 2008
Reputation Points: 189 [?]
Q&As Helped to Solve: 31 [?]
Skill Endorsements: 0 [?]
 
1
 

Thanks Salem. I'll try that. I'm new to the latest version of Visual Studio (just bought 2008 Pro), so I'm trying to find the best way to do things yet.

Member Avatar
jpw532
Newbie Poster
1 post since Jan 2010
Reputation Points: -4 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

This is useless. I'm going from an earlier version to a new version of Visual Studio and the code has to still be compiled back on the old version.

Member Avatar
Salem
Posting Sage
7,177 posts since Dec 2005
Reputation Points: 5,138 [?]
Q&As Helped to Solve: 970 [?]
Skill Endorsements: 41 [?]
Team Colleague
 
1
 

> I'm going from an earlier version to a new version of Visual Studio and the code has to still be compiled back on the old version.
And your question is what?
Did you read any of the thread, or did you just see the title and blast away?

Member Avatar
Frederick2
Posting Whiz
330 posts since Jul 2008
Reputation Points: 189 [?]
Q&As Helped to Solve: 31 [?]
Skill Endorsements: 0 [?]
 
0
 

Well, that doesn't cause the compilation to fail; it just causes piles of blasted warnings. I've been satisfactorily using Salem's suggestion ever since with no problems.

I tend to not use Visual Studio though for reasons such as this. Its basically a pain the whole routine one must go through to use it. My routine to set up a project is to first tell it not to make Debug builds, because I don't use debuggers. That takes a number of mouse clicks. Then I've got to sift through the various configuration options to paste the CRT_SECURE_NO_WARNINGS in the right place. Might be a few more things that need done too, depending if I want to use ansi instead of UNICODE. And of course the whole thing is slow and ponderous because its based on bloatware from Microsoft.

Of course, the ultimate solution to the CRT_SECURE_NO_WARNINGS is to use the SECURE versions of the string buffer minipulation routines I use so much and not the 'insecure' versions I've grown accustomed to since the early stone age. But hey! I hate to change! Anyway, about all I use C++ for is Windows CE programs and playing with COM. The data recorders my Windows CE programs run on aren't networked or connected to the internet so its a non point.

For reasons such as this though I prefer other development environments. I needed the Visual Studio software and I'm glad I have it. When I have a choice though I use something else.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article