user3557114
user3557114

Reputation: 1

Error when converting .obj to openGL

When I was converting .obj file to openGL i have some errors. I am not sure how to fix the error. I have change the sign to >, yet the error still persists.

1>------ Build started: Project: LoadObj Trial, Configuration: Release Win32 ------
1>  LoadObj Trial.cpp
1>LoadObj Trial.cpp(78): warning C4018: '<' : signed/unsigned mismatch
1>LoadObj Trial.cpp(90): error C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          D:\VISUAL STUDIO\VC\include\stdio.h(311) : see declaration of 'sscanf'
1>LoadObj Trial.cpp(109): warning C4018: '<' : signed/unsigned mismatch
1>LoadObj Trial.cpp(134): warning C4018: '<' : signed/unsigned mismatch
1>LoadObj Trial.cpp(136): warning C4018: '<' : signed/unsigned mismatch
1>LoadObj Trial.cpp(138): warning C4018: '<' : signed/unsigned mismatch
1>LoadObj Trial.cpp(140): warning C4018: '<' : signed/unsigned mismatch
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Upvotes: -1

Views: 174

Answers (1)

Andon M. Coleman
Andon M. Coleman

Reputation: 43319

LoadObj Trial.cpp(90): error C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

1> D:\VISUAL STUDIO\VC\include\stdio.h(311) : see declaration of 'sscanf'

That is not really an error, and it has got nothing to do with OpenGL. That is the MSVC compiler treating a level 3 security/deprecation warning as a compiler error. Your project is probably configured to treat level 3/4 warnings as errors.

To solve the "error", you can use the variant it suggest (which will make your code rather non-portable), or simply add #define _CRT_SECURE_NO_WARNINGS or add that definition to your pre-processor definitions in the project settings.

The other warnings, however, are impossible to diagnose without seeing your code. And it is pretty safe to assume that simply switching the direction of the comparison is not going to do anything useful, that will probably break things and will do nothing to solve the problem of comparing signed and unsigned values.


Regarding making the pre-processor definition I mentioned a project-wide setting, see the following screenshot (Visual Studio 2013 Pro):

  Project Settings

Upvotes: 1

Related Questions