A simple question, where I have perhaps just overlooked the obvious.
I am trying to use ApplicationSettings in C++ (.NET) using Visual Studio 2010 Express (I also use 2008 pro)
However I can get nowhere with this - if I try to use the form designer to add a setting i get "No settings file exists in project. Add a settings file and try again". How do I add a setting file (app.config)? There is no option in any of the "add" sections. I have tried adding a file manually both from within VS (create a new file and save) and from Explorer.
Before I crack and just write some code to read an XML config file - please can someone explain the correct way to setup and use app.config - just, for example, to save the location and size of the main form.
Is this a managed C++ project?
A settings file is based on .Net's ApplicationSettingsBase and ConfigurationManager classes, so unless you're using .Net you won't be able to use them easily.
EDIT: I've just created a managed C++ project, and you're right, there is no option to add a settings file.
In a C# project this produces a static class derived from ApplicationSettingsBase, which Visual Studio updates automatically from a GUI based configuration screen. I can only assume that there is no support for auto generation of a managed C++ class instead. Sorry.
Related
I've just recently changed from MacOS/Xcode to Windows/VS so I'm a little confused on how to do some things, but I was wondering how I could create a source file with a matching header at the same time instead of doing each file separately. XCode on Mac asks if you also want to create a header with the source file but I cant seem to see that anywhere on VS.
Am using Win11 and the latest version of VS.
I have done it by pressing Ctrl+Shift+X when C++ project is selected in solution explorer of Visual Studio. It should open a class wizard where you can add new or modify existing C++ classes.
Properties:Add New Item->C++ Class
Click OK.
Or
Create a .h file from function in cpp file:
Click the function name to highlight it.
ALT+SHIFT+F10-> Create Declaration/Definition
Maybe there are other plugins can do it.
When generating a new C++ project - specifically, I create a new "Empty Project", the directory the file is stored in seems to contain an .sdf file. This seems to be generated whenever I open the project in Visual Studio 2013, even after I delete it. I also seem unable to open it, though I sincerely doubt it could contain anything.
This project does use SFML 2.3, but won't be using databases in any real capacity, so I had not specified in any options that something like this should be done. I'm not quite sure as to why the system is doing this, then.
Basically, I just want to stop VS from making this file upon opening the project. I'm not sure if uninstalling SQL Server will do anything to solve this, or if there is something else I need to consider.
The sdf file is created and owned by Visual Studio, not your program. When you open a solution Visual Studio will check to see if this file exists. If it doesn't VS will create one and populate it with code browsing and other information about the projects it manages. If the file already exists VS will open it and update the database with any code changes that happened outside of VS.
Although this file is not required for Visual Studio to load a solution or project it is required for some very useful functionality to work correctly. There's no real benefit in preventing VS from creating or accessing this file and I recommend you abandon the idea of preventing VS from creating it.
I have to use text files files on my project on Visual Studio, and instead of working with file streams I'd like to add them directly to the build.
I have added them to the solution explorer and edited their properties changing the Item Type to Resource.
Now I want to know how may I access their content, say, put their text into a string. (I'm using C++)
PS: Is there a good tutorial about using resource files? Couldn't find any recent tutorial for visual studio.
To retrieve a user-defined resource from within your executable see the FindResource, LoadResource and LockResource APIs.
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.
Can anyone point me in the right direction how to configure Visual Studio 2005 with our C++ console project how we can include a 'File Version' in the details section of the file properties.
I've tried resource files without any luck. This is with a C++ project just for clarification, and big thank you for the guys you responded with C# suggestions.
Thanks in advance.
If you are talking about unmanaged c++, you need to add a version resource to the project.
right-click on the project, choose add - Resource.... Choose Version and press new.
There you can enter all info you need.
You have to have one VS_VERSION_INFO section in your resource (*.rc) file(s) that compile into your project.
In the Visual Studio 2005 Solution Explorer, open the context menu on your C++ project and choose Add, Resource.
Mark Version and click "New".
Fill in the fields as desired and save the file.
Build.
Now your project output has a FileInfo resource.
Please be aware that Windows Vista does not show all available version info in the Explorer context menu's "Details" tab.
For c++ projects I use StampVer and call it as a post build operation including check in/out of revision control for release builds.
Unless you have a good reason for your file version to be different than the version of the assembly inside, I think it is a better idea to provide the AssemblyVersion alone. If you do not specify an AssemblyFileVersion, it will automatically get the same value, so you can see your assembly's version directly in the file's properties.
The advantage is that you can use a wildcard and allow the version to be automatically incremented, so that every time you compile the library you get a different build and/or revision number. As far as I can tell, this trick does not work with AssemblyFileVersion, so you have to increment it by hand.
Of course, all this only applies if you're writing .NET code. Are you by any chance talking about a project using unmanaged code?