hi folks,

I have some 247 warnigs are same type warning

C4996: 'fopen' was declared deprecated

I am using makefile to compile my cpp program in Visual studio 2005.

I have added _CRT_SECURE_NO_DEPRECATE in preprocessor definition too. but still I do get the warnings . Could anyone help me?

hi folks,

I have some 247 warnigs are same type warning

C4996: 'fopen' was declared deprecated

I am using makefile to compile my cpp program in Visual studio 2005.

I have added _CRT_SECURE_NO_DEPRECATE in preprocessor definition too. but still I do get the warnings . Could anyone help me?

I assume that you understand why Microsoft Compiler gives this warning... so explaining the solution...

if you use precompiled headers add the following lines in the stdafx.h and rebuild the project.

#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE

another would be include the warning in the ignore specific warning in the project settings or defining the following pragma before using any deprecated function.

#pragma warning (disable : 4996)

or add the compiler directive /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE.

Well I used the IDE to compile, and I use the _CRT_SECURE_NO_DEPRECATE in the preprocessor and it has worked for me, didn't try with make files, but I am sure with the first solution that it would work if you are using the precompiled headers, disabling the 4996 warning altogether is not a good practice I think, although it is another solution to your question.

Hope the above help. Get back to us if you still get warning.

I have solved the warnings by adding the warinings by adding the
_CRT_SECURE_NO_DEPRECATE in the below format.

I have to modify the Makefile instead the project-->properites, because I do not have the options there to change(see my attachment.jpg file for the window)

# Compiler Flags CC = cl
MACH = -DPRO_MACHINE=29 -DPRO_OS=4
# Added _CRT_SECURE_NO_DEPRECATE
CCFLAGS = -c -fp:precise -DUSE_ANSI_IOSTREAMS -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_DEPRECATE

CFLAGS = $(CCFLAGS) $(INCS) $(MACH)

thanks for your reply.

Now my warnings reduced by 7 (great thing)


What is the difference between unlink and _unlink?
Does it depend on OS(windows /UNIX)?


warning C4090: 'function' : different 'const' qualifiers
warning C4996: 'putenv' was declared deprecated Instead, use the ISO C++ conformant name: _putenv
warning C4996: 'unlink' was declared deprecated Instead, use the ISO C++ conformant name: _unlink

how do solve this? what I have to add?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.