how get get rid of this warning?

This is a discussion on how get get rid of this warning? within the C Programming forums, part of the General Programming Boards category; when i compiled in "code blocks" compiler my code showed no wornings but when i compiled with visual studio 2005 ...

  1. #1
    Banned
    Join Date
    Oct 2008
    Posts
    1,535

    how get get rid of this warning?

    when i compiled in "code blocks" compiler my
    code showed no wornings
    but when i compiled with visual studio 2005 i got 4 warnings of this type:

    warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

    for each warning i get my grade cut off by a significant number
    how to fix this??
    Last edited by transgalactic2; 12-15-2008 at 07:57 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,660
    Go to Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor

    Then in the "Preprocessor Definitions" field set _CRT_SECURE_NO_WARNINGS so as to disable those needless warnings.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    so there is no problem??
    i thought maybe i use long variable
    and do %d
    in the scanf
    or the opposite case when i enter %ld
    in the scanf
    but the variable is integer
    ??

  4. #4
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    but i checked
    for every integer i wote %d in the scanf
    and in long i got %ld in the scanf

    so this is not a sign for the program to crush in some case?
    Last edited by transgalactic2; 12-15-2008 at 08:10 AM.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,660
    The problem is that you are using scanf(), and the Microsoft compiler has an arguably safer version that is non-standard and which it suggests to you by default through irritating warnings.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21