Best way to save source functions - c++

Newbie question: I've been trying to complete a couple of problems from the Project Euler site, using Visual studios 2010 as my IDE.
What is the best way for me to save and store the source so that I don't have to have 500 projects created?

Create a function for each problem, then just change which function you call from main.

The best way to "save" source code is in a version control system. My preference is Git.
I haven't used Visual Studio 2010 in anger, but I'm sure you can have multiple source files in a single project. You don't need to create one project per problem (although it may be a neat

Related

Is there a way to relink a solution without rebuilding any project?

I have a big C++ solution in Visual Studio 2008 with many projects, that links to other libraries.
sometimes I want to link the solution to different libraries, and for doing so and create a new exe file I need to re-linking the solution.
But, the re-linking can be done only if at least one of projects need a rebuild. so I manually change one line in the code and change it back...
Is there a better way to only redo the linking process?
Isn't there an option in the context menĂ¼ of the project? Only Project -> link only ?
Sorry I just translated it from my german dev studio 2008.
You could delete the exe. Thus it needs to be rebuilt which is a simple link.
Although if you use different libraries do you need different headers for them if so you need to delete objects - in this case probably best to dop a rebuild of the main project.
Probably the most complete alternative but most difficult to implement is to touch (ie change the modification timestamp) the library and headers you want to use and then Visual Studio build will do the minimum build.

C++ parsing a text file that is located online

Information about what I want to do:
-read in a few integer variables from a text file that will be located on a dropbox public folder.
-the variables will be used to trigger some if statements thus controlling my application remotely if I need to have it do something ( I would just save the variable I need to that text file and my program with would read from it every 5 seconds would see it and perform the required actions).
-this is a console application which is being built and compiled in visual studio 2010 on windows 7. The software will also be running on a win7 computer.
I need help with:
I already have read on using a library called libcurl. The problem is that I do not know how to link this library with my project in vs2010. Detailed instructions on how to do this on vs 2010 would be very helpful.
OR
if you can think of a better and easier way to accomplish what I need done, offer some advice and direction
It sounds like you're a novice, is that correct? If not then apologies for stating the obvious.
To use your compiled DLL in your application you need to 'add a reference' to it. You can do this by adding what is called a binary reference, where you simply tell visual studio where to find the dll. Or you can add a project reference if the project which is producing the dll is within the same solution. The best approach is to use something called nuget. It's a visual studio extension which automates the adding of binary references available from a public repository.
I have just done a search for libcurl on nuget.org and drew a blank. As I am unfamiliar with this library you may have better luck finding a nuget package as you will be a le to search using better terms that I did (curl and libcurl)
Whatever approach you take, just right-click on the project in which you want to use libcurl within the solution explorer and you should find an add reference option in the menu.

Default project in Visual C++ 2008

In Visual C++ 2008 ( Professional Edition )it is impossible to create default project for a .cpp file. Sometimes it is inconvenient. Is there an edition of Visual C++ 2008 which allows it?
It's available, assuming you've already written the .cpp file. Use File + New + Project From Existing Code. You'll get a point-and-click wizard with a bunch of questions that need to be answered.
I reckon you'll use this a few times, then discover it is just simpler to start a new project from scratch with the Win32 Console Application template. Just add your .cpp to the project's Source Files folder.
Why you can't do this?
You can normally create Win32 C++ project and have with this .cpp file.
You mean you don't want to create a solution each time? There's no getting around this. It can be useful to create a Sandbox solution and just fill that up with .cpp files to throw your ideas around on.

Using Tortoise SVN with C++ in Visual Studio 2008

I have an online repository with some .h and .cpp files that make up part of a project. I'm trying to check these out and use them in a new project, but am getting errors (C4627 and C1010). All the files have been added to the project (with Add>Existing Item...), and the subdirectories that contain these files have been added to the "Additional include directories" of the project.
Would I be better off having the entire project tree in the repository? My reason for not doing so is that my colleague and I are working on different parts of the code and so want to use different main methods to test things as we go, and I didn't see any need to be passing around any compiled code etc. since I assumed that given the .h and .cpp files (with the correct settings), visual studio would be able to compile the project.
What's the best way to make Visual Studio 2008 and TortoiseSVN work well together (without spending any money)?
Would I be better off having the entire project tree in the repository?
Most certainly yes. You should be able to check out and build without much effort. Creating a new project every time you want to build the source and having to configure it is way too much work.
My reason for not doing so is that my colleague and I are working on different parts of the code and so want to use different main methods to test things as we go, and I didn't see any need to be passing around any compiled code etc.
Ok, just put more than one project in the solution. There's no reason you can't have separate executable projects for separate tests.
I assumed that given the .h and .cpp files (with the correct settings), visual studio would be able to compile the project.
If all of the settings are the same, then, yes, it should compile fine, but why bother with the hassle when you don't have to?
Also AnkhSVN which isn't too bad and it's free. Also, lots of the windows it displays look like TFS (if you're familiar with it)
What's the best way to make Visual Studio 2008 and TortoiseSVN work well together (without spending any money)?
There are a bunch of programs that integrate SVN into Visual Studio. VisualSVN is one of them.
Apologies for the VisualSVN recommendation. We used to use it in an old project and I'm positive it was free then. Maybe they changed their license?

What is the purpose of Browse Information generated by Visual Studio

I got a huge C++ third-party project with set of project in one solution. So build time is rather long and Browse Information generation takes a lot too. So what is the purpose of Browse Information? What functionality will be lost if i disable Browse information generation?
Visual Studio 6 required browse information to do the things that Doug T. mentioned.
Newer versions of visual studio can use the browse information file, but by default use a newer Intellisense database. For those versions, there is basically an Intellisense daemon that builds the database in the background instead of being directly embedded in the build process. It really helps to have more than one processor or core when using Intellisense. Otherwise it can really bog down your system.
From here
Select Generate Browse Info under the
C/C++ project settings tab, for any
source-files that you want to be
included. This is very useful for
searching for function definitions and
declarations - just right-click a
function / variable and select "Goto
Definition Of..." and the IDE will
take you straight there.
You will lose some ability to easily navigate your code. This may matter a lot in a very large code base. I know that without it and tools like Visual Assist X, I would be lost. Still, Visual Studio has a very efficient find-in-files operation that cannot be completely replaced with browsing tools.