Displaying a Warning purposely in VC?

Started by
6 comments, last by SikCiv 23 years, 11 months ago
I use the Command line based compiler in Visual C++ 6 (cl.exe i think its called) via the use of a makefile and nmake.exe, so when I compile, it shows me the errors and warnings in a dos box. I was wandering if u can produce your own warning message? A good example would be when I code a new function, but couldnt be bothered to put all the features in the function at the present moment, I need something to hit me in the face to tell me I need to update the function at a later date. A warning from the compiler output would be fantasia... as so.. void MyFunkyNewFunktion() { NewCode3 != bla.bla[1]; NewCode2 /= bla.bla[2]; NewCode1 &= bla.bla[3]; // HACK: Couldnt be bothered at the moment... VCCompilerWarning("REMEMBER TO UPDATE MyFunkyNewFunction!"); } Compiler Output would be: Game.cpp(1201) : Warning C9999 REMEMBER TO UPDATE MyFunkyNewFunction! Possible?

  Downloads:  ZeroOne Realm

Advertisement
In VC, you can use the #warning preprocessor directive... just look in msdn for details...

Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com

Edited by - LaughingD on May 18, 2000 1:58:06 AM

Mark Fassett

Laughing Dragon Games

http://www.laughing-dragon.com

Thats not what im looking for. The Warning Preprocessor Directive only does things like disable certain warnings.

I need a Custom Warning message.

Or is there a text-output message function that outputs at the compiler output?

  Downloads:  ZeroOne Realm

Nah, nah... the #warning IS what you want. #pragma warning is what disables the warnings...

Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com

Mark Fassett

Laughing Dragon Games

http://www.laughing-dragon.com

Whats the syntax? Ive looked in the VStudio help, but its almost always impossible to find what u are looking for )-;
So I tried...

#Warning "blabla"
and..
#warning "blabla"

But when I compile it it says Invalid Preprocessor command.

Some code sample would help.


  Downloads:  ZeroOne Realm

what I think you''re looking for is:

#pragma message( messagestring )

do a search in help for #pragma to find the help for this function
===========================There are 10 types of people in the world. Those that understand binary and those that don't.( My views in no way reflect the views of my employer. )
Oh, oops... I failed to notice that the #warning I saw was a J++ thing... my fault. I know there is #error, which is why I didn't read too far into the #warning topic (there's one tiny little thing at the end that would have given me a clue).

What you really are looking for, I think is

#pragma message( messagestring )

This doesn't produce a warning, but it does put a message out to the standard output.

Sorry again for being midleading. I just wasn't thinking straight earlier this week.

Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com

And apparently, I'm still not thinking straight... I didn't notice what Gav pointed you to...

Edited by - LaughingD on May 19, 2000 5:27:11 PM

Mark Fassett

Laughing Dragon Games

http://www.laughing-dragon.com

Thankz Gav (and LaughingD eventually), its works perfect.

Later..

  Downloads:  ZeroOne Realm

This topic is closed to new replies.

Advertisement