Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I know this is a simple question, but I'm a bit puzzled about this. How would I import other .cpp files for use in my code? And better yet, how do I call the code from the files?

What I have tried:

Googling and unsuccessful documentation
Posted
Updated 13-Sep-23 4:14am
v2
Comments
Idd Jutt 2021 1-Sep-23 11:12am    
Is this new files you have written elsewhere, or new .cpp/.hpp to be included, basically the same right click the project and select add existing or add new
Idd Jutt 2021 1-Sep-23 11:27am    
do not understand "call the code from the files"

I would start with the tutorials on how to build using Visual Studio - see C++ development with Visual Studio | Microsoft Learn[^]. In particluar see the sections on creating projects & solutions.

If you are not using Visual Studio then you will have to add the CPP to the MSBuild project file - see Use MSBuild - MSBuild | Microsoft Learn[^]
 
Share this answer
 
Copy the files into your Project directory. Then in Solution Explorer, right click on the "Source Files" filter and click on the "Add Existing Item" link. Repeat (if required) for Header and Resource files.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900