Visual Studio 2012 filters? - c++

I just decided to learn C++ and I installed Visual Studio 2012. My friend told me it's a monstrous program and I should avoid it, but it has one of the best compiler ever (advanced error messages, etc.) and i found it useful in studying.
The problem is there are option called Filter except for real Folders. Source code is organized in IDE but the project folder is just messy, everything is in the root.
I think it's good for the compiler - you can't be wrong while including files. But since u want to share your source files with your friends who don't use VS it's necessary to have files organized in folders.
Is there any option to export files into folders based on filers?

Related

How to set up llvm-c++ api for Visual Studio 2017

I've been working on a compiler for my own little made up language for a school project, completed the Lexer already and built up most of the ASTBuilder but now I want to start generating LLVM-IR code to actually be able to do something with it and the problem is, I can't seem to figure out how to get the LLVM-C++ API to work on Visual Studio.
I went to LLVM's website and downloaded the latest package, copied the include and lib folders and set them up in the project properties but something just isn't quite working, Visual Studio complains I have linker errors even though I linked against the lib files and made sure I copied all of them. Saw it has many files called "CMakeLists.txt", tried to look it up but I can't quite understand it.
Thanks in advance for any help!

How to stop Visual Studio from putting 'mdd' at the end of library names

I use Visual Studio 2013 to make a CLR-compatible version of my C++ code library ('mylibrary.lib'). It's been working fine for years, but all of a sudden I'm getting 'LNK1104' errors because Visual Studio is looking for 'mylibrarymdd.lib'.
Why is it suddenly, magically tacking on 'mdd' to the library name instead of using the .lib file I specified? And how do I get it to stop doing this?
I've found two workarounds for this problem, but don't like either one of them. Hopefully someone is able to explain why these steps were unnecessary and then all of a sudden necessary.
The first and most obvious work-around is to modify the dependency's project settings so the target output filename matches what the consuming project is expecting -- namely, 'mylibrarymdd.lib'.
The second work-around is to use "/NODEFAULTLIB:mylibrarymdd.lib". This is required for every individual dependency with the auto-naming issue.
To get to the correct (IMHO) solution, one would need to know WHY Visual Studio is creating a "default library dependency" of 'mylibraryMDD.lib' in the first place. As I stated, it wasn't doing so before and there have been no recent updates to Visual Studio or the project files themselves.
I did find that there was a change to a dependency of 'mylibrary'. It pulls in the static OpenSSL libraries and those were updated. It's unclear how that would cause the above behavior, however.

C++ shift from Unix to Visual Studio in Windows

I am a professional working for a software firm.In my past company basically i was working on C & C++ on unix.Now i suddenly shifted to C++ on Windows and i feel like i am in a completely different world.Basically i am working on a very big application which was totally written in C++.To keep it simple ,i dont have the source code .I have the exe of the application and several other dependent files.it is a GUI application(several windows,reports,graphs and huge mathematical calculations are done by this application).Now i finally have the source code of the application which includes some headers,some vcproj files,some dsw files and several other which i dont even understand why the hell are they present.
Now as i C++ programmer my responsibility is to make all the BUGS that the clients identify replicate and fix them.
If its a bug on unix i can simply use the binary and source code and run gdb/dbx and find out the issue in some or other way like adding adding some printf statements.
But given the files i mentioned above.how could istart debugging an application in VC++ in VISUAL STUDIO.
Is it very difficult for a C++ programmer to shift from Unix to Windows.
Is ther any good resource which i could refer for this kind of change where i could grasp things quickly?
given the exe and the source code of the application how can i start debugging a program by running the application in VS C++-(BTW i am using VS 2005)
The main difference is that on Unix, you'll have Makefiles, which you won't find on Windows. Visual Studio organizes your code in projects and solutions, and those project files contain all the information VS needs to compile&link your projects.
If you have a *.sln file, just double click it to open it in VS. Then build the source (usually by pressing F6) and run in debug mode (usually F5).
More details:
A project is a collection of source files that result in 'something', usually a LIB, a DLL or an EXE.
A solution is a collection of projects. Useful when e.g. one project creates a LIB that is used by another project. When you set dependencies between projects, VS will build the projects in the right order.
Extensions used:
*.vcproj : Project file for C/C++ sources
*.vcproj..user : contains which windows are open in the GUI.
Can safely be deleted.
*.sln : Solution file
*.ncb : Intellisense database for a solution. Can safely be deleted.
*.suo : contains which windows are open in the GUI. Can safely be deleted.
*.dsw : Visual Studio 6.0 related file - not used in VS2005. (Replaced by *.sln IIRC)
./Debug/* : folder with all
intermediate files for a Debug build
(can be changed)
./Release/* : folder with all
intermediate files for a Release
build (can be changed)
That's all I can think of at the moment.
If you only have a .DSW file and not a .SLN file, then it means that the project was probably last worked on with VC6 and not one of the later Visual Studio versions.
That's a shame, because there have been lots of changes to the C++ compiler since VC6, and you're probably going to find the project doesn't compile with VS2005 without needing some minor changes to source code.
Do you have a .SLN file - if so, what's the version number at the top of the file (it's a text file)? If you don't have a .SLN file, can you get hold of VC6?
I would always try to get stuff going on an unfamiliar platform with the best matching tools, before I tried to bring it forward to later versions.
I understand your pain; I took the same path a few months ago.
You probably figured it out, but Visual Studio is not the exact alternative of gcc/g++. It embeds a text editor, a debugger, and so on.
Usually, you have two compilation "modes", debug and release. (you can add your own)
When in debug mode, all optimization are disabled and you can execute your program in the debugger, use step by step, add breakpoints, ...
Just start it using the F5 key.
More notes on the additional files:
In the Visual Studio world, .vcproj files represents "projects": a bunch of file that belongs to the same project (source files, headers, resources, ...).
A .dsw (old name for current .sln files I believe) is a "solution" file: a group of one or several projects which can have internal dependencies. Example: you can have in the same solution, a library and a software that depends on it. So that when you compile the whole solution, things are built in the correct order.
First thing you should try is to attach to the process while it's running (Ctr-Alt-P and select the process) if you have the .pdb (debug information) files you should be able to debug the process without re-building it.
If that fails try to un-check the "Require source files to exactly match the original version" option in Tools -> Options -> Debugging.
If that too fails you'll have to build the application again (by opening the .sln file and performing a build) so that the binary matches your source files.
Good luck.
Compile the code with debug info and press f5 (Start Debugging). I don't see where is the problem. On linux is sort of the same.
VS2005 can convert the dsw file for you to a sln file, but you need all of the original VC6 files in order for the conversion to be successful. For debugging please check out following msdn link, I hope this will help you.
http://msdn.microsoft.com/en-us/library/sc65sadd.aspx
Please select hyperlink "Debugging Native Code" for C++ specific.

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?

How do you create a simple comment header template for all new classes in Visual C++ 2010?

This may be a duplicate, but I haven't found anything that answers it thus far. My company passed a resolution that all files need to have a boilerplate comment header, with file name and copyright date among other things. I was hoping there would be an easy way to just create a header template that is added to the top of every new class (.cpp and .h files) added to the project with a couple of variables that are replaced based on the date, file name, etc.
Unfortunately, it seems like this is a much larger task that it seems it should be. I've looked into Manipulating Code using the Visual C++ Code Model and Manually Creating an Item Template and can't seem to get any of them to do what I want.
Sorry if this sounds like a "do my work for me" post, but to me this just isn't worth spending that much time on. If it's going to take a day to figure out the subtleties of extending Visual Studio, I can just manually add and edit the header for each new file, as it isn't done that often. Is there an easier method than those I was looking at, or a simple example on how to utilize those methods for my purpose?
This may not get you any further than you have already got, but Simon is close in that you can create C++ file templates in the way that he suggests, but the path to the C++ templates is C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcprojectitems (note that on 32-bit machine it will just be Program Files).
If you edit the file NewC++File.cpp, the next time you add a new C++ file to a project your template will be used. Alternatively you can create your own files in this folder and they will appear in the Add New Item dialog.
This won't solve your problem around inserting the current date in the header (assuming you want that to be automatically determined), but you could update the template that you're using once a year, and that would be slightly less of a chore.
HTH
What you are looking for is called : Code Snippets
I personnaly use the snippets provided into VAssistX but it's a shareware so it's might not be a good solution for your company.
By the way if you are developing application on Visual C++ without VAssistX you are wasting a lot of time ;)
There is also a code snippets manager into Visual Studio, i never used it but i found some documentation on google :
http://msdn.microsoft.com/en-us/library/d60kx75h(VS.80).aspx
and
http://blogs.microsoft.co.il/blogs/gilf/archive/2009/01/17/how-to-write-your-own-code-snippets.aspx
I hope it's will be helpfull.
Update: Unfortunately, the C++ templates do not work in the same way.
I have left the text below as a reference to anyone who finds this, but it only works for C#/VB.
You can definitely edit the class template for C# (we have done it for exactly the same reason as you - to include a standard header), I would assume you can do it for C++ too.
Check out these two directories:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\"
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\"
Somewhere in each of those directories will be a class template folder. For C# it's in a zip file here:
...\ItemTemplates\CSharp\Code\1033\Class.zip
Extract the zip, edit the template to include your header and re-zip it. You will also then need to place an unzipped copy under the ItemTemplatesCache folder, (following the same path - ...\ItemTemplatesCache\CSharp\Code\1033\Class)
There are more details here.
(Sorry, I'm on my Linux PC now so I can't check if these paths exist for C++. If you get it to work, post the correct C++ paths back here, and I'll update this answer to reference them)