1

Edit: Using windows.

Hopefully this is not too off-topic or silly, but I've uploaded a decently large project to my Github (around 40-50 source/header files each) by using the functionality in Visual Studios that allows you to push your project to the repository directly and be able to push/pull in what seems like a practical manner. My first question is if this feature is something that's recommended to use at all, or if you should rather "manually" upload your files to Github, and if so then how would you best go about publishing changes to your code?

Now, if this is indeed something that is practical and recommended for the not-so tech savvy person that uses programming as a tool for numerical calculations how can I make my repository look more eye-pleasing? From what I've seen in other repos people generally split their headers and cpp files into src and include folders. I could do this as well (and add additional subfolders into suitable groups) but there doesn't seem to be any functionality to do so on Github apart from changing the names of the individual files to push them into folders. Making folders on my local visual studios repo and pushing the changes doesn't seem to do anything either (apart from making visual studios not find my files when compiling). Is there a simple way to achieve the above, and what other considerations should I make? I'll add a link to my repo to show what it looks like precently just from pushing to github from visual studios.

https://github.com/OscarUngsgard/Cpp-Monte-Carlo-Value-at-Risk-Engine

Oscar
  • 279
  • 1
  • 10

1 Answers1

1

You need at a minimum a src folder to move the code away from the root.

We need the README more readily visible. If needed, create the directory locally, with mkdir, use notepad or even echo "FOO" > src/file.cpp to create the file in the right folder and then import it into Visual Studio, if the UI gives you trouble.

Later on, you'll have test, documentation, releases, all sort of other files. You don't want that mixed with your source.

You should also consider sub-directories for different areas:

src/financial src/maths src/ml

or whatever makes sense. Some people also go so far as splitting src and includes to separate .h headers and .cpp source.

You can do it with:

mkdir src
git mv *.cpp src/
git mv *.h src/

But then you'll need to adjust the Visual Studio project files (can't tell you how, don't have this compiler, myself)

Jeffrey
  • 11,063
  • 1
  • 21
  • 42
  • Thank you, I think I figured out a way to do this now. One "issue" I have now is that after moving some .h file to include/ I now have to change the .cpp files from #include file.h to #include include/file.h Is there a better way to do this then just doing some 50-odd "find and replace all" calls with the appropriate new paths? Maybe what you mean with adjust the visual studio project files? – Oscar Jun 15 '20 at 21:14
  • 1
    yes, somewhere, your IDE has a setting called "include paths" or similar. If you set it to "include/" it should work without you changing the source files, – Jeffrey Jun 15 '20 at 21:20
  • Thank you, I can only make this work by specifying the full path, like "C:\Users\oscar\source\repos\MCValueAtRisk\include". Is this what you meant? – Oscar Jun 15 '20 at 21:43
  • 1
    probably https://stackoverflow.com/questions/2676417/how-do-include-paths-work-in-visual-studio – Jeffrey Jun 15 '20 at 21:53