Compiler error for MessageBox::Show

  • Thread starter Thread starter Roger Crawfis
  • Start date Start date
R

Roger Crawfis

I am getting a very strange compiler error for the following code:
catch (OpenGLPanelException *openGLError)
{
//std::string * errorMessage = new
std::string(openGLError->errorString);
System::Windows::Forms::MessageBox::Show( "junk" ); //, "OpenGL Error",
MessageBoxButtons::OK,
//MessageBoxIcon::Exclamation );
exit(1);
}

The error message is:
Compiling...
Form1.cpp
d:\MSDev\Shared Projects\OpenGLPanel\Test1\Form1.h(75) : error C2039:
'MessageBoxA' : is not a member of 'System::Windows::Forms'
d:\MSDev\Shared Projects\OpenGLPanel\Test1\Form1.h(75) : error C2660:
'System::Windows::Forms::Control::Show' : function does not take 1 arguments
d:\MSDev\Shared Projects\OpenGLPanel\Test1\Form1.h(246) : warning C4244:
'argument' : conversion from 'double' to 'GLfloat', possible loss of data
Build log was saved at "file://d:\MSDev\Shared
Projects\OpenGLPanel\Test1\Debug\BuildLog.htm"
Test1 - 2 error(s), 1 warning(s)

It appears to want to replace the text as if a #define is taking precedence
somewhere. The include information is:
#include <windows.h>
#include <GL\gl.h>
#include <iostream>
namespace Test1
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace OhioState;

If I do not fully scope it, the tooltip seems to indicate MessageBox is the
MFC instance.
Any help or suggestions?
Roger
 
Word wrap made that read wrong. The single line of code, and I have tried
moving it to other places in my program, is the simple static
MessageBox::Show() call.
System::Windows::Forms::MessageBox::Show( "junk" );

Roger
 
It appears to want to replace the text as if a #define is taking precedence
somewhere.

Yes, MessageBox is #defined to MerssageBoxA in Winuser.h which is
indirectly included via Windows.h. If you can, remove the #include for
windows.h. Otherwise you can always #undef MessageBox.




Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top