Answer the question
In order to leave comments, you need to log in
How to connect a class to a form - C++/CLI?
there is a windowopen.h file
#include <SFML\Graphics.hpp>
#include <string>
class WindowOpen{
public:
int win_width, win_height;
WindowOpen(int WINW, int WINH)
{
win_width = WINW;
win_height = WINH;
sf::RenderWindow window(sf::VideoMode(win_width, win_height), "Test");
};
#include "windowapp.h"
#pragma once
namespace gameengine {
using namespace System;
......................
public: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
}
WindowOpen w(640, 480);
};
}
Ошибка 1 error C2059: синтаксическая ошибка: константа
Answer the question
In order to leave comments, you need to log in
1) in the first block of code, you may have missed the closing curly brace, check;
2) if you create a window, then most likely it will live for a relatively long time, and its lifetime will need to be managed manually. This means that it's time for you to figure out what pointers are and manual management of the memory / lifetime of an object (i.e. WindowOpen w (640, 480) is most likely not good)
3) immediately learn to give adequate names to entities in the program. WindowOpen is a function name, not a class name, perhaps you meant just Window.
4) if possible, do not use C++/CLI as a learning language. This is a docking dialect of C ++ for implementing the interaction of systems on top of .net and native ones - even an experienced C ++ developer can get confused in it, beginners cannot even look at it - it kills the soul. That MS on a default offers the project in studio is so historically developed. MS doesn't offer anything adequate for the C++ desktop right now, so my advice to you is either C# + WPF/WinForms or Qt + C++. SFML seems to work fine with Qt .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question