Joguinho de Campo Minado (C++)

1. Joguinho de Campo Minado (C++)

Fernando
phoemur

(usa Debian)

Enviado em 03/12/2017 - 22:21h

Boa noite.

Criei um joguinho de campo minado utilizando C++ e interface gráfica Qt 5 .

Gostaria da opinião dos colegas a respeito de possíveis bugs, possíveis novos recursos que seriam interessantes para adicionar mais pra frente, ou apenas se gostaram ou não.

Está lá no github:
https://github.com/phoemur/minesweeper

Pull requests are welcome...


  


2. Re: Joguinho de Campo Minado (C++)

Perfil removido
removido

(usa Nenhuma)

Enviado em 03/12/2017 - 23:44h

No meu Linux Mint não funciona:

Log:

g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o mainwindow.o mainwindow.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o minesweeper.o minesweeper.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o qrightclickbutton.o qrightclickbutton.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o moc_mainwindow.o moc_mainwindow.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o moc_qrightclickbutton.o moc_qrightclickbutton.cpp
In file included from /usr/include/c++/5/random:35:0,
from mainwindow.h:10,
from moc_mainwindow.cpp:9:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from /usr/include/c++/5/random:35:0,
from mainwindow.h:10,
from mainwindow.cpp:1:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from mainwindow.h:11:0,
from moc_mainwindow.cpp:9:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from moc_mainwindow.cpp:9:0:
mainwindow.h:38:5: warning: identifier ‘noexcept’ is a keyword in C++11 [-Wc++0x-compat]
bool is_valid_coord(int a, int b) const noexcept;
^
In file included from mainwindow.h:11:0,
from mainwindow.cpp:1:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.cpp:1:0:
mainwindow.h:38:5: warning: identifier ‘noexcept’ is a keyword in C++11 [-Wc++0x-compat]
bool is_valid_coord(int a, int b) const noexcept;
^
In file included from /usr/include/c+g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o mainwindow.o mainwindow.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o minesweeper.o minesweeper.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o qrightclickbutton.o qrightclickbutton.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o moc_mainwindow.o moc_mainwindow.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o moc_qrightclickbutton.o moc_qrightclickbutton.cpp
In file included from /usr/include/c++/5/random:35:0,
from mainwindow.h:10,
from moc_mainwindow.cpp:9:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from /usr/include/c++/5/random:35:0,
from mainwindow.h:10,
from mainwindow.cpp:1:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from mainwindow.h:11:0,
from moc_mainwindow.cpp:9:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from moc_mainwindow.cpp:9:0:
mainwindow.h:38:5: warning: identifier ‘noexcept’ is a keyword in C++11 [-Wc++0x-compat]
bool is_valid_coord(int a, int b) const noexcept;
^
In file included from mainwindow.h:11:0,
from mainwindow.cpp:1:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.cpp:1:0:
mainwindow.h:38:5: warning: identifier ‘noexcept’ is a keyword in C++11 [-Wc++0x-compat]
bool is_valid_coord(int a, int b) const noexcept;
^
In file included from /usr/include/c++/5/random:35:0,
from mainwindow.h:10,
from minesweeper.cpp:2:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from qrightclickbutton.cpp:1:0:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.h:11:0,
from minesweeper.cpp:2:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from minesweeper.cpp:2:0:
mainwindow.h:38:5: warning: identifier ‘noexcept’ is a keyword in C++11 [-Wc++0x-compat]
bool is_valid_coord(int a, int b) const noexcept;
^
In file included from moc_qrightclickbutton.cpp:9:0:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.h:11:0,
from mainwindow.cpp:1:
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.cpp:1:0:
mainwindow.h:24:10: error: ‘random_device’ in namespace ‘std’ does not name a type
std::random_device seeder {};
^
mainwindow.h:25:10: error: ‘mt19937’ in namespace ‘std’ does not name a type
std::mt19937 engine;
^
mainwindow.h:26:10: error: ‘uniform_int_distribution’ in namespace ‘std’ does not name a template type
std::uniform_int_distribution<int> dist;
^
mainwindow.h:31:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:33:33: error: ‘>>’ should be ‘> >’ within a nested template argument list
std::vector<std::vector<Cell>> nodes; //representation of the minefield
^
mainwindow.h:38:39: error: expected ‘;’ at end of member declaration
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: error: ‘noexcept’ does not name a type
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:45:22: error: expected ‘;’ at end of member declaration
bool check_end() const noexcept;
^
mainwindow.h:45:28: error: ‘noexcept’ does not name a type
bool check_end() const noexcept;
^
mainwindow.h:45:28: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:54:18: error: expected ‘;’ at end of member declaration
~Minesweeper() noexcept;
^
mainwindow.h:54:20: error: ‘noexcept’ does not name a type
~Minesweeper() noexcept;
^
mainwindow.h:54:20: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:60:16: error: expected ‘;’ at end of member declaration
void about() noexcept;
^
mainwindow.h:60:18: error: ‘noexcept’ does not name a type
void about() noexcept;
^
mainwindow.h:60:18: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:52:44: error: ‘nullptr’ was not declared in this scope
QWidget* parent = nullptr);
^
mainwindow.h:31:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:31:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h: In constructor ‘Minesweeper::Minesweeper()’:
mainwindow.h:53:41: warning: delegating constructors only available with -std=c++11 or -std=gnu++11
Minesweeper() : Minesweeper(8, 8, 10) {};
^
mainwindow.h:53:41: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
mainwindow.cpp: At global scope:
mainwindow.cpp:19:15: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
int val = 0; // 0 - 8 for showing adjacent mines.
^
mainwindow.cpp:20:20: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
bool is_flag = false;
^
mainwindow.cpp:21:20: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
bool is_mine = false;
^
mainwindow.cpp:22:20: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
bool is_open = false;
^
mainwindow.cpp: In constructor ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’:
mainwindow.cpp:30:13: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
size_x{sz_x},
^
mainwindow.cpp:31:13: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
size_y{sz_y},
^
mainwindow.cpp:32:12: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
mines{mns},
^
mainwindow.cpp:33:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
num_flags{0},
^
mainwindow.cpp:34:7: error: class ‘Minesweeper’ does not have any field named ‘engine’
engine(this->seeder()),
^
mainwindow.cpp:34:20: error: ‘class Minesweeper’ has no member named ‘seeder’
engine(this->seeder()),
^
mainwindow.cpp:35:7: error: class ‘Minesweeper’ does not have any field named ‘dist’
dist(0, (size_x*size_y)),
^
mainwindow.cpp:36:13: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
widget{new QWidget()},
^
mainwindow.cpp:37:12: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
nodes{}
^
mainwindow.cpp: At global scope:
mainwindow.cpp:138:29: error: expected initializer before ‘noexcept’
Minesweeper::~Minesweeper() noexcept
^
mainwindow.cpp: In member function ‘void Minesweeper::create_nodes(unsigned int, unsigned int)’:
mainwindow.cpp:208:11: error: expected nested-name-specifier before ‘sz_t’
using sz_t = std::vector<std::vector<Cell>>::size_type;
^
mainwindow.cpp:211:10: error: ‘sz_t’ was not declared in this scope
for (sz_t i = 0; i < x; ++i) {
^
mainwindow.cpp:211:22: error: ‘i’ was not declared in this scope
for (sz_t i = 0; i < x; ++i) {
^
mainwindow.cpp:212:15: error: ‘class std::vector<std::vector<Cell> >’ has no member named ‘emplace_back’
nodes.emplace_back(std::vector<Cell>(y));
^
mainwindow.cpp: In member function ‘void Minesweeper::insert_mines()’:
mainwindow.cpp:222:18: error: ‘engine’ was not declared in this scope
a = dist(engine) % size_x;
^
mainwindow.cpp:222:24: error: ‘dist’ was not declared in this scope
a = dist(engine) % size_x;
^
mainwindow.cpp: At global scope:
mainwindow.cpp:231:61: error: expected initializer before ‘noexcept’
inline bool Minesweeper::is_valid_coord(int a, int b) const noexcept
^
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.h:11:0,
from moc_mainwindow.cpp:9:
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from moc_mainwindow.cpp:9:0:
mainwindow.h:24:10: error: ‘random_device’ in namespace ‘std’ does not name a type
std::random_device seeder {};
^
mainwindow.h:25:10: error: ‘mt19937’ in namespace ‘std’ does not name a type
std::mt19937 engine;
^
mainwindow.h:26:10: error: ‘uniform_int_distribution’ in namespace ‘std’ does not name a template type
std::uniform_int_distribution<int> dist;
^
mainwindow.h:31:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:33:33: error: ‘>>’ should be ‘> >’ within a nested template argument list
std::vector<std::vector<Cell>> nodes; //representation of the minefield
^
mainwindow.h:38:39: error: expected ‘;’ at end of member declaration
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: error: ‘noexcept’ does not name a type
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:45:22: error: expected ‘;’ at end of member declaration
bool check_end() const noexcept;
^
mainwindow.h:45:28: error: ‘noexcept’ does not name a type
bool check_end() const noexcept;
^
mainwindow.h:45:28: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:54:18: error: expected ‘;’ at end of member declaration
~Minesweeper() noexcept;
^
mainwindow.h:54:20: error: ‘noexcept’ does not name a type
~Minesweeper() noexcept;
^
mainwindow.h:54:20: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:60:16: error: expected ‘;’ at end of member declaration
void about() noexcept;
^
mainwindow.h:60:18: error: ‘noexcept’ does not name a type
void about() noexcept;
^
mainwindow.h:60:18: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:52:44: error: ‘nullptr’ was not declared in this scope
QWidget* parent = nullptr);
^
mainwindow.h:31:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:31:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h: In constructor ‘Minesweeper::Minesweeper()’:
mainwindow.h:53:41: warning: delegating constructors only available with -std=c++11 or -std=gnu++11
Minesweeper() : Minesweeper(8, 8, 10) {};
^
mainwindow.h:53:41: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
Makefile:335: recipe for target 'mainwindow.o' failed
make: *** [mainwindow.o] Error 1
make: ** Esperando que outros processos terminem.
Makefile:345: recipe for target 'moc_mainwindow.o' failed
make: *** [moc_mainwindow.o] Error 1
In file included from mainwindow.h:11:0,
from minesweeper.cpp:2:
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from minesweeper.cpp:2:0:
mainwindow.h:24:10: error: ‘random_device’ in namespace ‘std’ does not name a type
std::random_device seeder {};
^
mainwindow.h:25:10: error: ‘mt19937’ in namespace ‘std’ does not name a type
std::mt19937 engine;
^
mainwindow.h:26:10: error: ‘uniform_int_distribution’ in namespace ‘std’ does not name a template type
std::uniform_int_distribution<int> dist;
^
mainwindow.h:31:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:33:33: error: ‘>>’ should be ‘> >’ within a nested template argument list
std::vector<std::vector<Cell>> nodes; //representation of the minefield
^
mainwindow.h:38:39: error: expected ‘;’ at end of member declaration
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: error: ‘noexcept’ does not name a type
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:45:22: error: expected ‘;’ at end of member declaration
bool check_end() const noexcept;
^
mainwindow.h:45:28: error: ‘noexcept’ does not name a type
bool check_end() const noexcept;
^
mainwindow.h:45:28: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:54:18: error: expected ‘;’ at end of member declaration
~Minesweeper() noexcept;
^
mainwindow.h:54:20: error: ‘noexcept’ does not name a type
~Minesweeper() noexcept;
^
mainwindow.h:54:20: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:60:16: error: expected ‘;’ at end of member declaration
void about() noexcept;
^
mainwindow.h:60:18: error: ‘noexcept’ does not name a type
void about() noexcept;
^
mainwindow.h:60:18: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:52:44: error: ‘nullptr’ was not declared in this scope
QWidget* parent = nullptr);
^
mainwindow.h:31:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:31:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h: In constructor ‘Minesweeper::Minesweeper()’:
mainwindow.h:53:41: warning: delegating constructors only available with -std=c++11 or -std=gnu++11
Minesweeper() : Minesweeper(8, 8, 10) {};
^
mainwindow.h:53:41: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
minesweeper.cpp: In function ‘int main(int, char**)’:
minesweeper.cpp:8:35: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
Minesweeper window (16, 16, 40); // (size, number of mines)
^
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
Makefile:342: recipe for target 'qrightclickbutton.o' failed
make: *** [qrightclickbutton.o] Error 1
Makefile:339: recipe for target 'minesweeper.o' failed
make: *** [minesweeper.o] Error 1
Makefile:348: recipe for target 'moc_qrightclickbutton.o' failed
make: *** [moc_qrightclickbutton.o] Error 1
+/5/random:35:0,
from mainwindow.h:10,
from minesweeper.cpp:2:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from qrightclickbutton.cpp:1:0:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.h:11:0,
from minesweeper.cpp:2:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from minesweeper.cpp:2:0:
mainwindow.h:38:5: warning: identifier ‘noexcept’ is a keyword in C++11 [-Wc++0x-compat]
bool is_valid_coord(int a, int b) const noexcept;
^
In file included from moc_qrightclickbutton.cpp:9:0:
qrightclickbutton.h:12:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.h:11:0,
from mainwindow.cpp:1:
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.cpp:1:0:
mainwindow.h:24:10: error: ‘random_device’ in namespace ‘std’ does not name a type
std::random_device seeder {};
^
mainwindow.h:25:10: error: ‘mt19937’ in namespace ‘std’ does not name a type
std::mt19937 engine;
^
mainwindow.h:26:10: error: ‘uniform_int_distribution’ in namespace ‘std’ does not name a template type
std::uniform_int_distribution<int> dist;
^
mainwindow.h:31:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:33:33: error: ‘>>’ should be ‘> >’ within a nested template argument list
std::vector<std::vector<Cell>> nodes; //representation of the minefield
^
mainwindow.h:38:39: error: expected ‘;’ at end of member declaration
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: error: ‘noexcept’ does not name a type
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:45:22: error: expected ‘;’ at end of member declaration
bool check_end() const noexcept;
^
mainwindow.h:45:28: error: ‘noexcept’ does not name a type
bool check_end() const noexcept;
^
mainwindow.h:45:28: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:54:18: error: expected ‘;’ at end of member declaration
~Minesweeper() noexcept;
^
mainwindow.h:54:20: error: ‘noexcept’ does not name a type
~Minesweeper() noexcept;
^
mainwindow.h:54:20: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:60:16: error: expected ‘;’ at end of member declaration
void about() noexcept;
^
mainwindow.h:60:18: error: ‘noexcept’ does not name a type
void about() noexcept;
^
mainwindow.h:60:18: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:52:44: error: ‘nullptr’ was not declared in this scope
QWidget* parent = nullptr);
^
mainwindow.h:31:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:31:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h: In constructor ‘Minesweeper::Minesweeper()’:
mainwindow.h:53:41: warning: delegating constructors only available with -std=c++11 or -std=gnu++11
Minesweeper() : Minesweeper(8, 8, 10) {};
^
mainwindow.h:53:41: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
mainwindow.cpp: At global scope:
mainwindow.cpp:19:15: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
int val = 0; // 0 - 8 for showing adjacent mines.
^
mainwindow.cpp:20:20: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
bool is_flag = false;
^
mainwindow.cpp:21:20: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
bool is_mine = false;
^
mainwindow.cpp:22:20: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
bool is_open = false;
^
mainwindow.cpp: In constructor ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’:
mainwindow.cpp:30:13: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
size_x{sz_x},
^
mainwindow.cpp:31:13: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
size_y{sz_y},
^
mainwindow.cpp:32:12: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
mines{mns},
^
mainwindow.cpp:33:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
num_flags{0},
^
mainwindow.cpp:34:7: error: class ‘Minesweeper’ does not have any field named ‘engine’
engine(this->seeder()),
^
mainwindow.cpp:34:20: error: ‘class Minesweeper’ has no member named ‘seeder’
engine(this->seeder()),
^
mainwindow.cpp:35:7: error: class ‘Minesweeper’ does not have any field named ‘dist’
dist(0, (size_x*size_y)),
^
mainwindow.cpp:36:13: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
widget{new QWidget()},
^
mainwindow.cpp:37:12: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
nodes{}
^
mainwindow.cpp: At global scope:
mainwindow.cpp:138:29: error: expected initializer before ‘noexcept’
Minesweeper::~Minesweeper() noexcept
^
mainwindow.cpp: In member function ‘void Minesweeper::create_nodes(unsigned int, unsigned int)’:
mainwindow.cpp:208:11: error: expected nested-name-specifier before ‘sz_t’
using sz_t = std::vector<std::vector<Cell>>::size_type;
^
mainwindow.cpp:211:10: error: ‘sz_t’ was not declared in this scope
for (sz_t i = 0; i < x; ++i) {
^
mainwindow.cpp:211:22: error: ‘i’ was not declared in this scope
for (sz_t i = 0; i < x; ++i) {
^
mainwindow.cpp:212:15: error: ‘class std::vector<std::vector<Cell> >’ has no member named ‘emplace_back’
nodes.emplace_back(std::vector<Cell>(y));
^
mainwindow.cpp: In member function ‘void Minesweeper::insert_mines()’:
mainwindow.cpp:222:18: error: ‘engine’ was not declared in this scope
a = dist(engine) % size_x;
^
mainwindow.cpp:222:24: error: ‘dist’ was not declared in this scope
a = dist(engine) % size_x;
^
mainwindow.cpp: At global scope:
mainwindow.cpp:231:61: error: expected initializer before ‘noexcept’
inline bool Minesweeper::is_valid_coord(int a, int b) const noexcept
^
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from mainwindow.h:11:0,
from moc_mainwindow.cpp:9:
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from moc_mainwindow.cpp:9:0:
mainwindow.h:24:10: error: ‘random_device’ in namespace ‘std’ does not name a type
std::random_device seeder {};
^
mainwindow.h:25:10: error: ‘mt19937’ in namespace ‘std’ does not name a type
std::mt19937 engine;
^
mainwindow.h:26:10: error: ‘uniform_int_distribution’ in namespace ‘std’ does not name a template type
std::uniform_int_distribution<int> dist;
^
mainwindow.h:31:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:33:33: error: ‘>>’ should be ‘> >’ within a nested template argument list
std::vector<std::vector<Cell>> nodes; //representation of the minefield
^
mainwindow.h:38:39: error: expected ‘;’ at end of member declaration
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: error: ‘noexcept’ does not name a type
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:45:22: error: expected ‘;’ at end of member declaration
bool check_end() const noexcept;
^
mainwindow.h:45:28: error: ‘noexcept’ does not name a type
bool check_end() const noexcept;
^
mainwindow.h:45:28: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:54:18: error: expected ‘;’ at end of member declaration
~Minesweeper() noexcept;
^
mainwindow.h:54:20: error: ‘noexcept’ does not name a type
~Minesweeper() noexcept;
^
mainwindow.h:54:20: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:60:16: error: expected ‘;’ at end of member declaration
void about() noexcept;
^
mainwindow.h:60:18: error: ‘noexcept’ does not name a type
void about() noexcept;
^
mainwindow.h:60:18: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:52:44: error: ‘nullptr’ was not declared in this scope
QWidget* parent = nullptr);
^
mainwindow.h:31:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:31:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h: In constructor ‘Minesweeper::Minesweeper()’:
mainwindow.h:53:41: warning: delegating constructors only available with -std=c++11 or -std=gnu++11
Minesweeper() : Minesweeper(8, 8, 10) {};
^
mainwindow.h:53:41: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
Makefile:335: recipe for target 'mainwindow.o' failed
make: *** [mainwindow.o] Error 1
make: ** Esperando que outros processos terminem.
Makefile:345: recipe for target 'moc_mainwindow.o' failed
make: *** [moc_mainwindow.o] Error 1
In file included from mainwindow.h:11:0,
from minesweeper.cpp:2:
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
In file included from minesweeper.cpp:2:0:
mainwindow.h:24:10: error: ‘random_device’ in namespace ‘std’ does not name a type
std::random_device seeder {};
^
mainwindow.h:25:10: error: ‘mt19937’ in namespace ‘std’ does not name a type
std::mt19937 engine;
^
mainwindow.h:26:10: error: ‘uniform_int_distribution’ in namespace ‘std’ does not name a template type
std::uniform_int_distribution<int> dist;
^
mainwindow.h:31:28: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:33:33: error: ‘>>’ should be ‘> >’ within a nested template argument list
std::vector<std::vector<Cell>> nodes; //representation of the minefield
^
mainwindow.h:38:39: error: expected ‘;’ at end of member declaration
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: error: ‘noexcept’ does not name a type
bool is_valid_coord(int a, int b) const noexcept;
^
mainwindow.h:38:45: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:45:22: error: expected ‘;’ at end of member declaration
bool check_end() const noexcept;
^
mainwindow.h:45:28: error: ‘noexcept’ does not name a type
bool check_end() const noexcept;
^
mainwindow.h:45:28: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:54:18: error: expected ‘;’ at end of member declaration
~Minesweeper() noexcept;
^
mainwindow.h:54:20: error: ‘noexcept’ does not name a type
~Minesweeper() noexcept;
^
mainwindow.h:54:20: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:60:16: error: expected ‘;’ at end of member declaration
void about() noexcept;
^
mainwindow.h:60:18: error: ‘noexcept’ does not name a type
void about() noexcept;
^
mainwindow.h:60:18: note: C++11 ‘noexcept’ only available with -std=c++11 or -std=gnu++11
mainwindow.h:52:44: error: ‘nullptr’ was not declared in this scope
QWidget* parent = nullptr);
^
mainwindow.h:31:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h:31:28: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
QLabel lab {QString("")};
^
mainwindow.h: In constructor ‘Minesweeper::Minesweeper()’:
mainwindow.h:53:41: warning: delegating constructors only available with -std=c++11 or -std=gnu++11
Minesweeper() : Minesweeper(8, 8, 10) {};
^
mainwindow.h:53:41: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
minesweeper.cpp: In function ‘int main(int, char**)’:
minesweeper.cpp:8:35: error: call to ‘Minesweeper::Minesweeper(unsigned int, unsigned int, unsigned int, QWidget*)’ uses the default argument for parameter 4, which is not yet defined
Minesweeper window (16, 16, 40); // (size, number of mines)
^
qrightclickbutton.h:12:50: error: ‘nullptr’ was not declared in this scope
explicit QRightClickButton(QWidget *parent = nullptr);
^
Makefile:342: recipe for target 'qrightclickbutton.o' failed
make: *** [qrightclickbutton.o] Error 1
Makefile:339: recipe for target 'minesweeper.o' failed
make: *** [minesweeper.o] Error 1
Makefile:348: recipe for target 'moc_qrightclickbutton.o' failed
make: *** [moc_qrightclickbutton.o] Error 1




Meu github:
#===============================#
# https://github.com/Python-Library-Work #
#===============================#
O universo e um infinito de possibilidades!!!



3. Re: Joguinho de Campo Minado (C++)

Paulo
paulo1205

(usa Ubuntu)

Enviado em 04/12/2017 - 17:38h

Use um compilador que aceite C++11 (provavelmente, o seu aceita, ao menos parcialmente; use a opção "-std=C++11").


4. Re: Joguinho de Campo Minado (C++)

Fernando
phoemur

(usa Debian)

Enviado em 12/12/2017 - 21:37h

Obs.: desculpe a demora (férias)

Para você compilar pode utilizar:

qmake-qt5 


Edite o arquivo "Makefile" e na linha que tiver CXXFLAGS você acrescenta:
-std=c++11
A linha deve ficar parecida com isso:

CXXFLAGS = -std=c++11 -pipe -O2 -fPIC -Wall -W -D_REENTRANT -fPIC $(DEFINES) 


Daí é só rodar o

make 


Que deve dar certo.
No desenvolvimento aqui utilizo o GCC 7.2 em que o c++11 já está ativo por default (estamos quase em 2018, já são 7 anos).
Depois do c++11 já tivemos o c++14 e este ano o c++17, a linguagem está evoluindo de forma constante estes anos.
O seu gcc seria o 5.3 ? Se for vai dar certo...

Um abraço.


5. Re: Joguinho de Campo Minado (C++)

Perfil removido
removido

(usa Nenhuma)

Enviado em 12/12/2017 - 22:00h

phoemur escreveu:

Obs.: desculpe a demora (férias)

Para você compilar pode utilizar:

qmake-qt5 


Edite o arquivo "Makefile" e na linha que tiver CXXFLAGS você acrescenta:
-std=c++11
A linha deve ficar parecida com isso:

CXXFLAGS = -std=c++11 -pipe -O2 -fPIC -Wall -W -D_REENTRANT -fPIC $(DEFINES) 


Daí é só rodar o

make 


Que deve dar certo.
No desenvolvimento aqui utilizo o GCC 7.2 em que o c++11 já está ativo por default (estamos quase em 2018, já são 7 anos).
Depois do c++11 já tivemos o c++14 e este ano o c++17, a linguagem está evoluindo de forma constante estes anos.
O seu gcc seria o 5.3 ? Se for vai dar certo...

Um abraço.


Ok, eu já resolvi o problema, valeu.


Frases que fazem sentido.
Flutuações Quânticas podem Existir, assim como o Decaimento do Vácuo.
O Futuro não importa, o que importa e da para frente. HAHAHA



6. Re: Joguinho de Campo Minado (C++)

Fernando
phoemur

(usa Debian)

Enviado em 23/12/2017 - 15:03h

Blz.
Agora acabei de implementar as funcionalidades que queria.
Valeu.






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts