Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual C++: How to embed and display a compile time message in code?

Is there a way to embed a message in code that is displayed during compile-time when that piece of code is being compiled? The messages are diagnostic in nature and should not modify or abort the compile process.

(Disclaimer: I know the answer to this question. I didn't find it asked on Stack Overflow and I think it would be an useful addition to the knowledge base here.)

like image 773
Ashwin Nanjappa Avatar asked Jun 11 '09 07:06

Ashwin Nanjappa


1 Answers

This is one way to do it:

#pragma message("Your Message Here")

https://msdn.microsoft.com/en-us/library/x7dkzch2.aspx

like image 84
2 revs, 2 users 57% Avatar answered Oct 07 '22 16:10

2 revs, 2 users 57%