Visual Studio - How to create and use a template? - c++

I have got the SFML library, for graphics etc for C++. Is there a way to save a template with its settings, and then create a new project with that template? This would much easier, instead of linking up the library and all the files every time. I have tried creating a template, but when I open it, there is no code. Thanks

Related

Share C++ source files across solution projects for tempalte use

I have three projects in a visual studio solution in which the code consists of lots of template code. This therefore means I can't compile the code into a DLL or static library because then I can't use the template classes with new types anymore. One of the projects at the moments acts as the 'core' and the other two need to use the headers (by additional include directories) and source files of that core project and use its template classes. I want to find a way to automatically pass the source code files of that core project to the linker in the other projects so they can use the source code. I could copy the files but then im going to be updating the core lots and I do not want to keep copying and adding files to the other two projects. How could I do this? Im not using C-Make, only visual studio and I wish to keep it that way.

Embarcadero windows libraries and packages

This is my first time with Embarcadero RAD Studio (C++, not Delphi) and, despite of many searches on its site and the rest of Internet, I'm still confused with some concepts.
My goal, by now, is to set a OpenGL Core Profile and go on with OGL stuff (which I'm acquainted with). With other IDE/Compiler I'd add the opengl32 library, use wglCreateContextAttribsARB and glew.
Digging into Embarcadero files I find C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\win32\release\psdk\opengl32.lib, C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\win32c\release\psdk\opengl32.lib (note the 'c' after win32, what's that?) and C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\win64\release\psdk\opengl32.a
So I suppose I could just "Project->Add to Project..." the library, instead of "import" from Windows system as it seems was needed many years ago. But I'm confused because RAD may add the required libs on its own, at least for controls, right?
But I've meet with ".pas" files, which seems to load anything needed. Actually, the C:\Program Files (x86)\Embarcadero\Studio\20.0\source\rtl\win\Winapi.OpenGLext.pas seems enough, so I could avoid glew. My confusion is that I don't know if a ".pas" file can be used (and how) for VCL C++, not Firemonkey, not Delphi.
I have not be able to find wglCreateContextAttribsARB, nor a replacement for setting a Core Profile context.
Summarizing:
Do I need to add system libs? How?
How to use ".pas" files?
Which is the difference between win32 and win32c dirs?
How to set a OGL Core Profile context? I mean, should I go with the route of retrieving a function pointer to
wglCreateContextAttribsARB or RAD provides another way?
Does RAD provide for C++ a replacement of glew?
1.Do I need to add system libs? How?
Normally yes. unless you are using a component that has taken care of adding the library. In Win32 you have to use #pragma link "opengl32.lib" and in win64 you have to add #pragma link "opengl32.a" to your cpp code.
2.How to use ".pas" files?
You do not need to add the files in the source directory to your project. Embarcadero is nice enough to include the source code for most of its components with the product. This is so you could understand how it works and if you need to change some behavior you can create a new class derived from the class that you want and override the function in question. In general C++ builder allows adding Pascal units to C++ project and it will take care of creating the header file automatically. But in your case it is not necessary.
3.Which is the difference between win32 and win32c dirs?
C++ builder comes with 2 32 bit compilers for Windows. One is clang based and supports C++14 and the libraries that have been compiled with it are in win32 directory. The other one is the classic compiler and the libraries that have been compiled with it are in win32c directory. Unless you have checked the "Use Classic Compiler" in project settings, you don't have to worry about it.
4.How to set a OGL Core Profile context? I mean, should I go with the route of retrieving a function pointer to wglCreateContextAttribsARB
or RAD provides another way?
I'm not aware of any components that RAD studio may provide. You should search https://torry.net/ or http://www.delphipages.com/ or many more places that exists out there for a component that helps you whith what you need.
5.Does RAD provide for C++ a replacement of glew?
What is "glew"?

Is there a way to create a project template for an unmanaged C++?

I've been looking at the MS site How to: Create Project Templates trying to figure out how to make a project template based on a sample project that I wish to deploy to my company. However in this page: How to: Create Item Templates, it says:
Note
You cannot export templates for C++ projects
So now I'm a bit confused and annoyed. Can I make a C++ project template or not? If not, then how does MS do it? If so, how do I do it.

How do i use a bunch of .h and .cpp files to create a static library that can be used in another c++ Project

I am trying to learn C++ from some Stanford Course and they have a custom library which contains a bunch of header files(.h) and their associated source (.cpp) files.
I want to create new C++ projects in xcode 6.x to try out code and include those custom header files in my new projects.
I have no freaking idea how to include those files in my project so that i can peacefully #include "blahblahblah.h" and use functions from that header file without issues.
I am new to both xcode, c++(although i know some coding part) and anything else with this process.
Summary:
I have a folder Library which contains a series of .h and .cpp
files.
I have XCode 6.x.x/Eclipse installed.
I want to create a new C++ project and use #include
"OneOfThoseHeaderFiles.h" and then use a function or something from
those header files.
Also assume i have no clue how to run some command line codes that i see a lot of.
If someone can please tell me in the most simple way(preferably step-by-step) i would be so eternally grateful and sing praises to you until the day i die :)
Note: Either XCode or Eclipse is fine. I really just want to start coding.
I have spent the better part of a whole week trying out xcode, eclipse etc and trying to follow a ton of steps to get it working but i just cant get how to add the files without issues. Either the info seems to be for Xcode 4.x and every menu seems changed or the suggestions are so complicated that a novice like me cant figure it out.
First off, almost all the information for Xcode will be available on the Apple Developer's portal:
https://developer.apple.com/library/prerelease/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/start_project.html#//apple_ref/doc/uid/TP40010215-CH2-SW5
To create a simple static library on Xcode 6 you start by creating a new project, then under OS X - Framework and Library select Library, on the next window change the Framework to None (Plain C/C++ Library) and static (since that is what your are stating).
Once your project is created, add the existing headers and sources to your project, either by dragging them with the mouse or with the add files drop menu from the right click functionality, you can create a new group in Xcode if you want some order for them.
When adding the files, on the add window shown you can select to either copy them or use their current location.
If needed you might have to change the "header search path" in your target configuration under "Build Settings", if it is the first time you are using Xcode some of this will sound weird but I am sure you will find most of it on the Apple Developers portal in great detail.
If you want to test the files without having to create an external static library you could create a command line project and test them faster and easier.

How to create a Visual Studio 2008 C++ project template?

I've used the "Export Template" feature numerous times for C#, ASP.NET, WinForms, etc. projects. Today I tried to do it for a C++ project and noticed "Export Template" was grayed out in the File-menu.
Is it not possible to create C++ template projects in VS 2008 ?
yes it is: the ones you see already when creating a new project are in $VsInstallDir)/vcprojects. To create one yourself, you basically create a .vsz and a.vsdir file in which you describe your project template, a bunch of script/html files for your own wizard, and the template files itself (.vcproj, additional content etc.). It is not very easy, but it is possible and very handy once done. Complete explanation is on MSDN, it's too much to elaborate on here.
Same goes for project items/classwizards, they all can be customised.