I am using the following script to build a C++ project:
msbuild D:\proj.vcxproj /p:Configuration="Release" /p:Platform="x64" /p:BuildProjectReferences=false /p:AssemblySearchPaths="D:\Import\GenericAIC\Include" /p:AdditionalLibPaths="D:\Export\Release"
I am getting an error that it can't find a certain lib. that lib is present in the D:\Export\Release folder which is set as p:AdditionalLibPaths
The project compiles perfectly in Visual studio.
Any thoughts?
Since you are building a project and not a solution,
you don't have the $SolutionDir, and MSBuild cant interpert all the macros in the project file.
you just need to add /Property:SolutionDir="" and everything will compile.
Related
I currently have a C++ project that is built using msbuild.
Once the project is built I get an exe along with multiple dll files.
Is there a way to tell msbuild to link to those libraries statically ?
I cannot open the project in visual studio but I can make changes to the vcxproj.
Any suggestions on how I can accomplish that ?
In the vcxproj files, change:
<ConfigurationType>DynamicLibrary</ConfigurationType>
To
<ConfigurationType>StaticLibrary</ConfigurationType>
Also, in the PreprocessorDefinitions section(s), remove xxx_EXPORTS (where xxx is the name of the project) and _USRDLL, and replace with _LIB
Note: each of these (including ConfigurationType) will appear once for each Configuration you have (i.e. Debug, Release, etc.).
I tried to add a lib file into a clean project, and the modification of vcxproj file are below, hope it can help you:
Library Paths and Include Directories
Additional Dependencies
I'm trying to use CMake to build the Bullet Physics 3 source code for Visual Studio 2012.
I've tried using the CMake GUI to build the projects and the command line version. Each time I get a set of vcxproj and sln files:
project.sln
ZERO_CHECK.vcxproj
ALL_BUILD.vcxproj
BulletCollision.vcxproj
BulletDynamics.vcxproj
BulletSoftBody.vcxproj
LinearMath.vcxproj
This is not what I expected. The documentation here: says there should be BULLET_PHYSICS.sln that does not appear.
Furthermore when I try to import the projects into Visual Studio and do a build all of the #include lines fail. They're trying to find the files originally referenced in the Bullet Physics source directory and failing rather than looking the the current Visual Studio project folder where I've put the CMake built output. I tried manually editing all the project and solution files which contained many occurrences of the original source path and not my new build directory but this made no difference.
Why is CMake failing to build Bullet Physics properly?
i am new on programming in windows and in QT.
I started a QT project and want include yaml-cpp 0.30
Now i have different problems. First i wanted to build the lib with cmake and Visualstudio but i am not sure if i did this right.
I start Cmake and build with VS2010 compiler. Then i load the file
build\CMakeFiles\2.8.11.2\CompilerIdCXX\CompilerCXX.vcxproj in VS 2010 but i cant build this or dont know how.
And how i integrate this build lib inside QTCreator?
Or i have the possibility to build all inside QTCREATOR?
thanks for your help
CMake will build a Visual Studio solution (a .sln file); you don't need to go into the CMakeFiles directory to find it. There should be a solution file in the top build directory.
I downloaded cpptest from internet, and I want to build it using Visual Studio 2008.
The problem is that instead of .sln and vcproj file, Makefile.am is distributed, and I believe that all the all the necessary included file is included in the Makefile.am.
How to use Makefile.am to generate VS project files? I tried to use Cmake, but there is no CMakeList in the distribution.
Edit: Thanks to all the answers! There is a sln file distributed after all. But I am still interested to know the answer to my original question.
the visual studio project files for cpptest are in the win directory, not in the src directory where the makefile is..
edit
makefiles are meant to be used with GNU make. If you want that on windows, you can look at Mingw, GnuWin32 or Cygwin. But they also require gcc for compiling, so you won't really be using VS.
However, for most projects that do not have external dependencies it's no big deal if you do not have the VS project file: after all a makefile is just a list of the source files and some compilation options. To successfully build projects like cpptest, you could just create an emtpy VS project, add all source files to it, set output type to executable, build it and you're done. Eventually you can tune optimization options, but for the rest the default options will just do fine.
Go to win\VisualStudio.NET and you will find a VS solution file.
I just downloaded the archive and found the .sln file. It is under: /win/VisualStudio.NET. You can open that with VS2008 and update it, it should work.
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.