We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,390 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

_crt_secure_no_warnings

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?

3
Contributors
5
Replies
5 Months
Discussion Span
3 Years Ago
Last Updated
10
Views
Frederick2
Posting Whiz
330 posts since Jul 2008
Reputation Points: 244
Solved Threads: 31
Skill Endorsements: 0

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

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,875
Solved Threads: 953
Skill Endorsements: 27

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.

Frederick2
Posting Whiz
330 posts since Jul 2008
Reputation Points: 244
Solved Threads: 31
Skill Endorsements: 0

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.

jpw532
Newbie Poster
1 post since Jan 2010
Reputation Points: 6
Solved Threads: 0
Skill Endorsements: 0

> 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?

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,875
Solved Threads: 953
Skill Endorsements: 27

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.

Frederick2
Posting Whiz
330 posts since Jul 2008
Reputation Points: 244
Solved Threads: 31
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0622 seconds using 2.65MB