Click here to Skip to main content
15,884,472 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCannot initialize iterator with vector type defined in class Pin
ForNow12-Oct-22 16:40
ForNow12-Oct-22 16:40 
AnswerRe: Cannot initialize iterator with vector type defined in class Pin
CPallini12-Oct-22 21:42
mveCPallini12-Oct-22 21:42 
QuestionCreate a Makefile from this mess Pin
pkfox8-Oct-22 2:56
professionalpkfox8-Oct-22 2:56 
AnswerRe: Create a Makefile from this mess Pin
Richard MacCutchan8-Oct-22 5:34
mveRichard MacCutchan8-Oct-22 5:34 
GeneralRe: Create a Makefile from this mess Pin
pkfox8-Oct-22 5:42
professionalpkfox8-Oct-22 5:42 
GeneralRe: Create a Makefile from this mess Pin
Richard MacCutchan8-Oct-22 5:57
mveRichard MacCutchan8-Oct-22 5:57 
GeneralRe: Create a Makefile from this mess Pin
pkfox8-Oct-22 6:17
professionalpkfox8-Oct-22 6:17 
AnswerRe: Create a Makefile from this mess Pin
k505413-Oct-22 5:53
mvek505413-Oct-22 5:53 
If you are interested in using the power of make to only compile modified sources that are newer than the target you should be able to do something like this
CPPFLAGS = -I /home/pjk/vcpkg/packages/cpr_x64-linux/include/cpr \
    -I /home/pjk/C++/CallCommandsAPI/Headers/ \
    -I /home/pjk/vcpkg/packages/rapidjson_x64-linux/include/ \
    -I /home/pjk/vcpkg/packages/cpr_x64-linux/include/

LDFLAGS = -L /home/pjk/vcpkg/packages/cpr_x64-linux/lib/ \
    -lcpr -lcurl -lpthread -lssl -lcrypto

SRCS = $(wildcard Source/*.cpp)
OBJS = $(SRCS:.cpp=.o)

ifdef DEBUG
   CXXFLAGS += -ggdb
   LDFLAGS += -ggdb
else
   CXXFLAGS += -O2
   LDFLAGS += -O2
endif

callapi: $(OBJS)
        $(CXX) $(LDFLAGS) $^ -o $@

clean:
        rm -f callapi $(OBJS)
I've added clean and debug options to help maintain your code. To make a debug version you do
Shell
make DEBUG=1
Note that $CPPFLAGS and $CXXFLAGS are standard make variables and will be expanded when trying to compile the individual object files, without us having to explicitly tell make to do so.
If you don't want the object files mixed in the source directory, look into using $(patsubst) [Text Functions (GNU make)](https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#Text-Functions) and/or other make functions to manipulate targets. With some fancy footwork you could also get debug and production objects built at the same time, but I'll leave that as an exercise for the reader!
Keep Calm and Carry On

GeneralRe: Create a Makefile from this mess Pin
pkfox13-Oct-22 21:40
professionalpkfox13-Oct-22 21:40 
GeneralRe: Create a Makefile from this mess Pin
k505414-Oct-22 4:13
mvek505414-Oct-22 4:13 
QuestionIs this array of 2D vectors? Pin
Sk. Azraf Sami7-Oct-22 20:32
Sk. Azraf Sami7-Oct-22 20:32 
AnswerRe: Is this array of 2D vectors? Pin
Richard MacCutchan7-Oct-22 21:35
mveRichard MacCutchan7-Oct-22 21:35 
QuestionStyle question Pin
Mircea Neacsu3-Oct-22 15:33
Mircea Neacsu3-Oct-22 15:33 
AnswerRe: Style question Pin
Graham Breach3-Oct-22 21:23
Graham Breach3-Oct-22 21:23 
GeneralRe: Style question Pin
Mircea Neacsu4-Oct-22 2:27
Mircea Neacsu4-Oct-22 2:27 
AnswerRe: Style question Pin
CPallini3-Oct-22 23:47
mveCPallini3-Oct-22 23:47 
GeneralRe: Style question Pin
Mircea Neacsu4-Oct-22 2:28
Mircea Neacsu4-Oct-22 2:28 
GeneralRe: Style question Pin
CPallini7-Oct-22 1:35
mveCPallini7-Oct-22 1:35 
AnswerRe: Style question Pin
BernardIE53177-Oct-22 3:14
BernardIE53177-Oct-22 3:14 
GeneralRe: Style question Pin
Mircea Neacsu7-Oct-22 3:18
Mircea Neacsu7-Oct-22 3:18 
GeneralRe: Style question Pin
BernardIE53177-Oct-22 3:27
BernardIE53177-Oct-22 3:27 
GeneralRe: Style question Pin
Mircea Neacsu7-Oct-22 3:40
Mircea Neacsu7-Oct-22 3:40 
Question'System': a namespace with this name does not exist Pin
Kevin Marois3-Oct-22 6:12
professionalKevin Marois3-Oct-22 6:12 
AnswerRe: 'System': a namespace with this name does not exist Pin
Richard MacCutchan3-Oct-22 6:26
mveRichard MacCutchan3-Oct-22 6:26 
GeneralRe: 'System': a namespace with this name does not exist Pin
Kevin Marois3-Oct-22 6:30
professionalKevin Marois3-Oct-22 6:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.