Error "string" is undefined

VS 2013 keeps saying that "String" is undefined, but I ain't sure what the problem is.

#include "MyForm.h"
#include "String"

using namespace System::Windows::Forms;


[STAThread]
int main(cli::array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

Organizer1::MyForm form;
Application::Run(%form);
}
Last edited on
I dont really know what's going on in my program. But if you want to use string, it's

#include <string>

and string is part of the std library. So you'll need to do std:: and also it's string with a small s, not a big one like you have it there.

Sorry if this is not what you were looking for.
Hi,

The OP's code is CLI/C++ which is quite different to standard C++, apart from that I have no idea.

Maybe a CLI forum might be a better place to ask?
The CLI String is in the namespace System.

int main(array<System::String^> ^ args)

My Visual C++ 2010 creates the main function like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "stdafx.h"
#include "Form1.h"

using namespace Test;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	// Enabling Windows XP visual effects before any controls are created
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 

	// Create the main window and run it
	Application::Run(gcnew Form1());
	return 0;
}
Topic archived. No new replies allowed.