Update pretty much everything so that it compiles

Also update the script so that it uses the correct executable
This commit is contained in:
Segcolt 2024-10-15 23:19:06 -03:00
parent 5f153a71d3
commit 0a47e5ffcb
4 changed files with 11 additions and 10 deletions

1
.gitignore vendored
View File

@ -32,3 +32,4 @@
*.out
*.app
build

View File

@ -1,12 +1,12 @@
# Flag para alterar o padrão do compilador
standart = -std=c++11
standart = -std=c++17
# Flags para otimizar o arquivo executável
optimize_flags = -O3 -pipe -flto
# Flags para ativar todos os avisos do compilador
warnings = -Wall -Wextra -Werror -Wshadow -Wformat=2 \
-Wformat-overflow=2 -Wundef -Wconversion -fanalyzer -Wwrite-strings
warnings = -Wall -Wextra -Werror -Wformat=2 -Wno-maybe-uninitialized \
-Wformat-overflow=2 -Wundef -Wconversion -Wwrite-strings
# Flags para depurar o código
sanitize = -fsanitize=address,undefined,pointer-compare,pointer-subtract
@ -21,17 +21,17 @@ objectdir = $(builddir)/$(objectname)
.PHONY: all debug
all:set_flags compile
all:set_flags $(objectdir)
debug:set_debug_flags compile
debug:set_debug_flags $(objectdir)
compile:random.o sa.o
$(objectdir):$(builddir)/random.o $(builddir)/sa.o src/main.cpp
$(CXX) $(CPPFLAGS) $(builddir)/random.o $(builddir)/sa.o src/main.cpp -o $(objectdir)
random.o:
$(builddir)/random.o:src/random.cpp
$(CXX) $(CPPFLAGS) src/random.cpp -o $(builddir)/random.o -c
sa.o:
$(builddir)/sa.o:src/sa.cpp
$(CXX) $(CPPFLAGS) src/sa.cpp -o $(builddir)/sa.o -c
set_flags:

2
run.sh
View File

@ -3,7 +3,7 @@
IFS=$'\n'
if [[ -z $EXEC ]]; then
EXEC="build/main.out"
EXEC="build/sabp"
fi
if [[ -z $TEST_FOLDER ]]; then

View File

@ -219,7 +219,7 @@ class solution {
sequence10.reserve(boxes.size());
sequence11.reserve(boxes.size());
for (size_t i = 0; i < choice; i++) {
for (size_t i = 0; i < (size_t)choice; i++) {
if (boxes[choice].swappable10(boxes[i], capacity)) {
sequence10.push_back((int)i);
}