compiling multiple cpp files


compiling multiple cpp files



I am writing c++ in notepad++ using nppexec plugin and compiling with minGW.



I have a folder structure of:


projckt/
- main.cpp
- head/
-- vtk.h
- src/
-- vtk/
--- vtkFile1.cpp
--- vtkFile2.cpp



How do I compile and link? For my "hello world" scripts I used:


npp_save
cd "$(CURRENT_DIRECTORY)"
g++ $(FILE_NAME) -std=c++11 -o $(NAME_PART)
NPP_RUN $(NAME_PART)



This works fine, I want a solution where I don't have to add a new .cpp file to the command when I create one. I have tried:


npp_save
cd "$(CURRENT_DIRECTORY)"
g++ *.cpp -std=c++11 -o $(NAME_PART)
NPP_RUN $(NAME_PART)



It seems that the .cpp files in the sub directories is not included. Is there a way similar to copying subtree folders in unix cp -r.


.cpp


cp -r





You might use dedicated IDE to handle cpp workspace.
– Jarod42
Sep 7 '17 at 12:22





Possible duplicate of g++ compile source files existing in another directory
– Andre Kampling
Sep 7 '17 at 12:24





@Jarod42 I used Visual Studio 2017 but felt that I did to much in the back ground, I want to learn what happens in the background before I rely on a IDE
– Malthe Eisum
Sep 7 '17 at 12:25





@AndreKampling How do I impliment this in notepad++ with nppexec on windows
– Malthe Eisum
Sep 7 '17 at 12:35





@MaltheEisum: Using makefiles see wikipedia and how to make a simple makefile.
– Andre Kampling
Sep 7 '17 at 12:38










By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?