#First C++ GUI send as much hate as you like
44 messages ยท Page 1 of 1 (latest)
There's a lot of inconsistency in your code style here, e.g.
void MainWindow::on_winButton_clicked()
{
// vs
double loadWins(double wins) {
Stule is all preference, but be consistent
Use a unique_ptr instead of raw new/delete
This will simplify your mainwindow class
return (losses);
MyReadFile.close();
```the close here is dead
You also don't need to manually close c++ streams here, they clean themselves up on destruction
Just some comments/advice, good work ๐
Ohhh yeah, the function()
{
}
Those ones were auto generated but I always use function() {
}
haha
Got no clue what that is uhhh
it's basically a pointer that gets deleted automatically once it goes out of scope, so you don't need to delete it manually nor use new, it also can't be copied, meaning you can't have 2 unique pointers pointing to the same memory
Sounds pretty high level
I can't even figure out how to compile my code so I can run it outside the Qt environment
So I have to run Qt to launch it
are you using any sort of build system
I'm not sure what that is ๐
I guess not?
Literally cannot figure out how to run the program outside of Qt
it's a tool that allows you to compile your projects more easily, especially when working with multiple files or external libraries
CMake is a powerful and comprehensive solution for managing the software build process. CMake is the de-facto standard for building C++ code, with over 2 million downloads a month.
Oh I think my project is using Qmake
ohh
you should be able to run the project by running make in the terminal in the location where the makefile is
you need to install it first I'm pretty sure
yeah
I just cd to the directory and type make?
yes the directory where the makefile is
should be in build
Ohh here
yeah
Why can't I access the D drive ๐ญ lmao
uh
It's like I can't go further back than C:/
maybe try running cmd in administrator
try just writing D:
you need to install it with mingw package manager
For me a CMakeLists.txt like this worked:
cmake_minimum_required(VERSION 3.24)
project(YourProjectName)
set(CMAKE_CXX_STANDARD 17)
#Path to Qt lib (Maybe you have to change all Qt5 with Qt6)
set(CMAKE_PREFIX_PATH "C:/Qt/5.15.2/mingw81_64")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt5 COMPONENTS
Core Widgets Gui
REQUIRED)
#Your files
add_executable(YourProjectName main.cpp)
target_link_libraries(paint
Qt::Core
Qt::Widgets
Qt::Gui
)