我已經離開了C++一段時間,它可能只是我愚蠢,但爲什麼這會給我一個錯誤(代碼下面的錯誤)。C++:追加文本
代碼:
// NetworkServer.cpp : main project file.
#include "stdafx.h"
#include "Form1.h"
#include <winsock2.h>
#include <iostream>
using namespace std;
using namespace NetworkServer;
[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());
public void setUsers()
{
string connectedUsers[] = {"John", "Alex", "Phillip", "Steve"};
Form1->txt_connectedClients.AppendText(connectedUsers[1]);
}
return 0;
}
錯誤:
1>NetworkServer.cpp(22): error C2143: syntax error : missing ';' before '->'
1>NetworkServer.cpp(22): error C2143: syntax error : missing ';' before '->'
我們需要看看Form1是一個類還是一個實例,你能提供更多的代碼嗎? – 2011-04-04 21:41:28