• Advertisement
Sign in to follow this  

problom in compiling

This topic is 4328 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have a code which worked fine in vc6 and now i got vc8 and i get few errors and i have no idea why. here is the errors:
c:\documents and settings\יהונתן\שולחן העבודה\parabola\parabola\lesson1.cpp(158) : warning C4996: 'vsprintf' was declared deprecated
        c:\program files\microsoft visual studio 8\vc\include\stdio.h(345) : see declaration of 'vsprintf'
        Message: 'This function or variable may be unsafe. Consider using vsprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
c:\documents and settings\יהונתן\שולחן העבודה\parabola\parabola\lesson1.cpp(178) : warning C4996: 'fopen' was declared deprecated
        c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
        Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
c:\documents and settings\יהונתן\שולחן העבודה\parabola\parabola\lesson1.cpp(814) : error C2668: 'pow' : ambiguous call to overloaded function
        c:\program files\microsoft visual studio 8\vc\include\math.h(575): could be 'long double pow(long double,int)'
        c:\program files\microsoft visual studio 8\vc\include\math.h(527): or 'float pow(float,int)'
        c:\program files\microsoft visual studio 8\vc\include\math.h(489): or 'double pow(double,int)'
        while trying to match the argument list '(int, int)'
c:\documents and settings\יהונתן\שולחן העבודה\parabola\parabola\lesson1.cpp(814) : fatal error C1903: unable to recover from previous error(s); stopping compilation


Share this post


Link to post
Share on other sites
Advertisement
The error tells you how to fix it.
Quote:
To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details

Define _CRT_SECURE_NO_DEPRECATE in your preprocessor directives in your project settings. Or use the new secure functions.

As for the error about pow(), what does your line look like? What is the type of the varibles passed to pow()?

Also, this is the wrong forum. This should be in General Programming, as it has as much to do with DirectX as it does socket code.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Also, this is the wrong forum. This should be in General Programming, as it has as much to do with DirectX as it does socket code.
I would go for "For Beginners" myself. You really need to learn your tools before you dig into the "real" stuff [smile]

Jack

Share this post


Link to post
Share on other sites
ummm dude.... i'm not a newbie though..... just never used visual studio 2005 before......
i had experience with this stuff...
before i went learning directx i learned OpenGL O_o

Share this post


Link to post
Share on other sites
Quote:
Original post by mc30900
ummm dude.... i'm not a newbie though..... just never used visual studio 2005 before......
i had experience with this stuff...
before i went learning directx i learned OpenGL O_o


Don't take offense of what have been said. THere is nothing wrong in posting to the beginner's forum.

The deprecated warnings are not errors - they are only warnings. You are free to ignore them.

The only error is about pow(). If you forget to include math.h (or cmath if you are programming in C++) then you are using the std::pow() function that is declared in xcomplex (I think; I may be wrong). This function is a templateed function that takes two args, and both should be of the same type - ie you can't mix integers with floats, for example. The error is raised because the compiler can't tell which version it should instantiate. You can correct the error by explicitely telling him which version it should use (two ways: using std::pow<TYPE>(val1, val2); or std::pow((TYPE)val1, (TYPE)val2));. Another way to correct the error is to #include <cmath> - in this case, you code will use the version which is declared in cmath.

HTH,

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement