#First C++ GUI send as much hate as you like

44 messages ยท Page 1 of 1 (latest)

wide granite
plucky flicker
# wide granite

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 ๐Ÿ™‚

wide granite
wide granite
snow turret
# wide granite 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

wide granite
#

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

snow turret
#

are you using any sort of build system

wide granite
#

I guess not?

#

Literally cannot figure out how to run the program outside of Qt

snow turret
wide granite
#

Oh I think my project is using Qmake

snow turret
#

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

wide granite
#

uhhhhh

#

cmd?

snow turret
wide granite
#

I just cd to the directory and type make?

snow turret
wide granite
snow turret
#

should be in build

wide granite
#

Ohh here

snow turret
#

yeah

wide granite
wide granite
#

It's like I can't go further back than C:/

snow turret
#

maybe try running cmd in administrator

wide granite
#

But I also can't cd to D:\

#

I'm so confused

snow turret
#

try just writing D:

wide granite
snow turret
#

you need to install it with mingw package manager

wide granite
#

Uhhhhhhhhhh

#

I'll probably just launch it through qt ahah

lament cargo
#

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
)