Add include dir and -I./include for headers

This commit is contained in:
benn 2025-04-27 11:18:03 +02:00
parent eea814ed48
commit 0fd88fcee9
2 changed files with 55 additions and 12 deletions

View file

@ -30,7 +30,7 @@
APP = myapp
# C++ compiler
#CXX:=clang++
# CXX:=clang++
CXX := g++
@ -93,18 +93,41 @@ OBJS := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC))
# -D_FORTIFY_SOURCE=2 -O2 # buffer overflow check. -D_FORTIFY_SOURCE=1 also possible
# -Wfloat-equal # testing floating-point numbers for equality is usually bad
# -Wpointer-arith # warn if anything depends upon the size of a function or of void
_CXXFLAGS=-Wall -Wextra \
-Wconversion -Wsign-conversion \
-march=x86-64 \
-Wformat-security \
-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 \
-ftrapv \
-D_FORTIFY_SOURCE=2 -O2 \
-Wfloat-equal \
-Wpointer-arith
##_CXXFLAGS=-Wall -Wextra \
## -Wconversion -Wsign-conversion \
## -march=x86-64 \
## -Wformat-security \
## -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 \
## -ftrapv \
## -D_FORTIFY_SOURCE=2 -O2 \
## -Wfloat-equal \
## -Wpointer-arith
_CXXFLAGS=-Wall -Weffc++ -pedantic \
-pedantic-errors -Waggregate-return -Wcast-align \
-Wcast-qual -Wchar-subscripts -Wcomment \
-Wdisabled-optimization \
-Wformat -Wformat=2 \
-Wformat-nonliteral -Wformat-security \
-Wformat-y2k \
-Wimport -Winit-self -Winline \
-Winvalid-pch \
-Wlong-long -Wmissing-braces \
-Wmissing-format-attribute \
-Wmissing-include-dirs -Wmissing-noreturn \
-Wpacked -Wparentheses -Wpointer-arith \
-Wredundant-decls -Wreturn-type \
-Wsequence-point -Wshadow -Wsign-compare -fstack-protector-all -Wstack-protector \
-Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default \
-Wswitch-enum -Wtrigraphs \
-Wunknown-pragmas -Wunreachable-code \
-Wvariadic-macros \
-Wvolatile-register-var -Wwrite-strings\
-Werror=return-type \
-Werror=narrowing \
-ftrapv -Wfloat-equal -Wpointer-arith \
-D_FORTIFY_SOURCE=2 -O2
CXXFLAGS = $(NETBEANSBUILD) $(DBG_REL) $(_CXXFLAGS)
CXXFLAGS = $(NETBEANSBUILD) $(DBG_REL) $(_CXXFLAGS) -I./include/
LIBS = $(NETBEANSBUILD)
# Uncomment one of the following to select an output format

20
include/add.h Executable file
View file

@ -0,0 +1,20 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/cppFiles/file.h to edit this template
*/
/*
* File: add.h
* Author: benn
*
* Created on February 24, 2023, 11:07 PM
*/
#ifndef ADD_H
#define ADD_H
int add(int x, int y);
#endif /* ADD_H */