how to set configuration of log4cpp for visual studio 2008 - c++

i want to use log4cpp library in my code for logging. But,for windows platform i dont know how to configure the library. I am using Visual Studio 2008.
Any help will be appreciated.

Use the workspace and project files in subdirectory msvc8. (You may need to adjust include/log4cpp/config-win32.h and the project files to your particular needs).
You may also opt for compilation of source using cygwin and call exported functions from library.

Related

Is the visual studio release mode exe file standalone or not?

I want to build a single standalone executable file for a windows console application built in Visual Studio 2019. By standalone, I mean that I want a single exe file that I can move to any location on any computer and it will still run without extra files surrounding it (no dependencies).
For the life of me, I can't find a clear answer anywhere.
Question 1: Is the visual studio "release" executable file standalone?
Question 2: How do I make a standalone exe file that will run anywhere, no matter what libraries my code depends on?
Question 3: Can this be done inside visual studio, or do I need other software to do it?
You could use Microsoft Visual Studio Installer to deploy a Visual C++ Application.
For third-party libraries, you could select static linking version. If there is no static link version and only dll, copy the corresponding dll together when publishing.
For the c++ runtime library, select the static compilation method: Properties->C/C++->Code Generation->Runtime Library->Multi-threaded (/MT).
Also, you could use depends.exe (a Microsoft small tool) to view the dll, and then package it together.

External C++ source files in android studio?

Here is the drill. I have a cross-platform project written mostly in C++ (more on this later) that runs on windows, android and ios.
Is there any way in which android studio can be configured to have a custom directory that contains all the native C++ code ? By custom, I mean external to the main folder in which the android studio project resides in.
I'm guessing you can see where I'm getting at... I have a cross-platform project that can be opened from 3 different IDE's... visual studio, android studio and xcode and I want to be able to write / edit / compile the code from all of them.
Let's say I have the following main hierarchy:
projectDir
src (C++ source files .cpp)
include (C++ headers .h)
_visualStudio (visual studio project)
_xcode (xcode project)
_androidStudio (android studio project)
assets (resources .png etc)
others...
This is what I want to achieve, but I am unable to figure out how can I configure an android studio project to be able to accept external source files, but most importantly to be able to see and edit them from the android studio IDE. Basically I want to tell android studio... "Look, this is the path for the native files, treat them as if they belong to the project".
I know this is possible from visual studio and from xcode because I already did that, but up until now I used my own build system for android and I had no need for android studio. Is there any way to achieve this ? Perhaps some kind of symbolic folder links ?
The thing is I want to keep only a single copy of my shared resources (src, include and assets should only be in one place, but should be available for android studio as well).
So far the only solution is to keep them inside android studio project directory, and change visual studio paths to look for them there, but I find this very nonprofessional.
EDIT:
Is there any addFileToProject (as in visual studio) in android studio in which the file can be outside the project ?
After a bit of more digging I found that it is actually possible.
You just have to create a directory junction like this (inside app/src/main/cpp where the files would normally be).
mklink \J linkName linkDestination(can be outside the project)
Android studio will be able to see the containing folder as it's own (it sees it as a link, but you can double click it to expand the contents). You can also edit source files inside it with the only mention that you have to add these files within CMakeLists.txt or whatever build file you are using in order to have intellisense (you get a sync warning from android studio if the files aren't referenced anywhere in the build files).
Later edit... if you are using junctions for Java / Kotlin files in an android studio project, make sure to set the source sets through the junctions as well... in order to avoid visual errors like 'duplicated class'.

How to produce platform independent source files (which can generate project files for anyone using cmake) from a visual studio solution?

I know cmake is a tool which can produce visual studio solution files from source files. I see many of c++ projects are stored in the github in that way. My problem is how create that source. Is there anyway to generate it on visual studio or anyother way.? I have created a project by using visual studio . So I have the solution file. I want to upload it in to github as a portable source which can produce project files later using cmake for anyone.

Run C++ analysis with VS solution file

I want to analyse a more complex C++-Project with SonarQube (v4.4) and the Cxx-Plugin v0.9.1 (Community C++).
It includes many sub-projects in different directories.
I got a VS2005 solution file (*.sln) which referes to the relevent *.vcproj files or alternativ mwc + mpc files.
I was now wondering, what the best way to do this analysis is.
Sure, I could write a sonar-project.properties file manually with all directories.
But isn't there a possibilty to run the analysis using the given workspace / project files I got? I could think of e.g. Sonar-Runner readout information from that files to create modules with given direcotry (and maybe automatically includes the defined addionaly includes).
I found Plug-Ins like "Analysis Bootstrapper for Visual Studio Projects Plugin" or the .Net-Plug-In, but obviously they don't support vcproj files.
Thanks for any help and best regards
Visual Studio comes with C++ static code analysis, but for 2005/2008 you need the team edition. 2010/2012 it is available in the premium edition. It is now available in the 2013 professional edition.
Otherwise I would look here

Using a DLL with unmanaged code in Visual Studio 2010?

I'm fairly new to C++ and an trying to figure out to use the TagLib library for a project I am working on. I'm working with unmanaged C++ in Visual Studio 2010 on Windows 7 64bit. I've never used an external library before so I'm very confused on how to go about this.
From this blog entry I got the libtaglib.a and taglib.dll files. I ran across this SO question on how to use TagLib, but it deals with QT Creator, not Visual Studio and I'm not knowledgeable enough about the subject to understand what is being said to translate it into what needs done for Visual Studio.
So, some questions:
Is it even possible to do this with unmanaged code?
What exactly is the function of a .a file?
Most importantly, how do I go about using the taglib.dll in my program??
I've been all over Google looking for a way to do this, but my major problem is that everything I run across is over my head. Please let me know if more info is required. Any help is very much appreciated! Thanks!
I seem to have gotten it working successfully. Here's a rough outline of what I did:
1.) I used CMake to generate the Visual Studio solution.
2.) I attempted to build the tag project in the VS solution, but it failed.
3.) I made the corrections to a few source files as outlined here: http://old.nabble.com/taglib-fails-to-compile-with-MS-VC%2B%2B-2010-td29185593.html
4.) I built the tag project again in release mode. This time it was successful.
5.) I copied the resulting dll, def, and lib files to the same directory as the source files for my project.
6.) I copied the header files from the taglib source to a subdirectory in my project (not sure if this entirely good practice)
7.) In my project settings, I set the subdirectory with the header files as an additional include directory.
8.) I added the dll, exp, and lib files to my project by just going to Add>Existing Item.
9.) I added some code from the taglib examples and built it. Everything worked so I think I got it.
One caveat I ran into, since the DLL was built in release mode, my project had to be run in release mode or it would crash. I'm guessing that if I replaced the DLL with one built in debug mode I could run my program in debug mode, but I have not tried this.
You cannot use libraries specific to GCC (you can tell because they have .a extensions) with Visual Studio. You will have to build the library from source in order to use it with MSVC. Once you have done that it's a simple matter of adding the .lib generated from the build process to your project and things should work out of the box. (Note that it's a .lib you need whether you're compiling for dynamic linking or not -- doesn't matter in msvc land)
EDIT -- after looking at TagLib itself --
In order to compile TagLib you'll need to get the CMake build system, and TagLib itself, and have CMake build you a visual studio solution. Using that solution you'll be able to build the .libs and .dlls you need. Note that because TagLib is a KDE library, you'll probably need to also build some QT bits in order for everything work work successfully. However, I don't have specific experience with the library so I'm not going to be all that helpful here.
Yo do not have to recompile the source (to create the .lib file) if you have the .dll file. With dumpbin /exports and lib (both came with Visual Studio) yo can create a lib that you can link with your application. In this link you can see a nice explanation: http://www.coderetard.com/2009/01/21/generate-a-lib-from-a-dll-with-visual-studio/
But as Billy Said, probably you would need other parts of QT to use this library.