compiling c++ projects with sln file in ubuntu - c++

This may be a stupid question, but I've been trying to compile a larger project that was originally associated with visual studio in Ubuntu. I settled on cmake to do this, but it needs a cmakelist file. As I don't want to set this up manually, since I'll have to port several thousand pages like this, is there a way to have cmake read the sln files visual studio generates?
Any way that would let me compile the projects automatically on Ubuntu would be great.

Related

Code::Blocks: Code Blocks IDE does not read backslashes from a .vcsproj file

I am importing a C++ project that was created in Visual Studio on a Windows machine, into my Code::Blocks IDE using Linux Ubuntu 13.10. After importing the .sln file, Code::Blocks was able to detect the files but it could not read them due to the \'s in the .vcsproj file (which was created in VS on the Windows machine).
After replacing all of the \'s in the .vcsproj with /'s, everything works fine, but was this the correct solution? This is an open source project, so I wonder if there is a platform-independent solution, or should we expect each user to build the project themselves? Should the .vcsproj or .sln file be excluded from the repository?
Welcome to the world of cross platform development!
Consider using something like Cmake or Premake to generate the project files for the platform you are developing on.
This way any developer can take the CMake\Premake script and generate vcxproj files if they are on Windows or Codeblocks proj files for Linux/Windows, or even Gnu Makefiles if they are so inclined.

How to generate Qt .pri files from Visual studio project at the end of the build?

Can I setup my solution in visual studio to automatically generate the .pri files at the end of the build? I thought about perhaps writing a batch file to call a command to generate the .pri files, is it possible to generate .pri files from the command line?
I am working on a Qt C++ application in visual studio made up of 9 subprojects. I also created a QMake based build of the same application using Qt visual studio add in to generate the .pro and .pri files.
The setup is working well, and the application compiles successfully on Windows (using VS2010) and Mac OS X (Qt creator). The problem is that every time I change the projects in visual studio (for example by adding or removing source files), I have to manually regenerate the .pri file for the project so it gets picked up by qmake.
I'm using the Qt visual studio add in v1.1.11. Visual studio 2010, Qt 4.7.4.
I created a small python script to generate .pri files from visual studio .vcxproj.filter files, I've added it to our post build script that runs at the end of the visual studio build, and it seems to work quite well. If anyone else wants it, you can find it here:
https://github.com/JamesSmaldon/prigen.git
You know, Visual Studio is independent on Qt environment. The only opportunity to do what you want is use of some VS plugins, but I've never actually seen such an option anywhere.
As for me, when I add some file to VS solution, I append it manually to the *.pro file.

Qt Compilation - Using qmake on Windows

I'm having a bit of trouble trying to compile Qt programs under Windows. I'm on a work machine so I'm trying to be wary about what things I'm installing/setting up etc since I was given a procedure to follow originally to get this working (That didn't work), so please keep that mind.
My development environment is normally Visual Studio on Windows 7. To install Qt I unzipped a few files into C:/Qt and setup my environmental variables to reflect it. I've written a short example file in Visual Studio and was able to have it compile; however things got tricky once I started using more than one file in the project.
For example:
Attempt 1 - Only had 1 .cpp file; ran 'qmake -tp vc projectname.pro' then went back into Visual Studio and loaded in the project, Built, and ran the file fine.
Attempt 2 - Had the original .cpp file, added a .h & .cpp to reflect a popup dialog, ran 'qmake -tp vc projectname.pro', loaded in the project, and my two new files were gone.
So two questions here:
1) How do I have multiple files when working in Visual Studio?
2) If I'm making a file from scratch just using notepad, how do I proceed? (ie: I make projectname.cpp, Use the designer to create the .ui file, run 'qmake -project' and 'qmake -tp vc projectname.pro' and the .ui file is not converted into the .h file as it's apparently supposed to do.
Reading "C++ GUI Programming with Qt Second Edition (ISBN-13: 978-0-13-235416-5) if it's of any help.
Thanks,
Thomas
Install the visual studio addin (*) it detects the Q_OBJECT macro and handles all the extra build steps
If you want to use qmake it's described here, it's a nicer simpler format than regular makefiles and the VS addin-can convert between .pro files a visual studio solution.
(*) scroll down to other downloads, select version 1.1 for Qt4 or 1.2 for Qt 5

use msbuild to compile a vcxproj created by vs2010 on a computer without vs

I have created a large Visual C++ 10.0 project which builds nicely within the visual studio ide as well as within the "special" Visual Studio Command Prompt using msbuild with a vcxproj file.
However this project needs to be compiled by computers that do not have the vs ide, but only have the msbuild tool and the vc++ 10.0 runtime files.
The problem is that the vcxproj (created by the vs ide) file contains references to files such as Microsoft.Cpp.Default.props and Microsoft.Cpp.targets which clearly won't be available in a computer without visual studio.
Since all the compile and link command line options are available and fixed (no changes will be necessary), how is it possible to create a new vcxproj file to implement the compiling and linking of the project using these options?
I was finally able to make some tests on a "clean" computer. These are the results:
First, I installed .NET Framework 4.0 from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17718. Along with it, MSBuild 4.0 was also installed automatically. When I tried to compile I got the following error:
error MSB4019: The imported project "H:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
which means that extra files are needed to compile the vcxproj and these files were missing. Note that simple project files written by hand (and not by the VS IDE) are expected to compile without problems since they contain no references to theses files (I did not test it for certain).
Next, I installed Windows SDK 7.1 from http://www.microsoft.com/download/en/details.aspx?id=8442. The error about missing files disappeared, but I got a new one. This new error (along with the way I overcomed it) is described in http://www.damirscorner.com/CommentView,guid,9121bd6b-876c-4051-8487-de1b95a7e919.aspx.
Doing the above successfully allowed me build my vcxproj file on a computer without vs2010.
I think that the files that you mention are not part of Visual Studio. They are part of MSbuild.

Compiling libmodplug on windows

I'm trying to compile a release version of love2d on windows. I got all the dependencies downloaded / compiled. However, I have one last problem that I cannot fix:
The object or library file
'lib\libmodplug.lib' was created with
an older compiler than other objects;
rebuild old objects and libraries
I had similar issues with other dependencies, however I was able to compile those dependencies. The libmodplug source does not provide a Visual Studio solution or project file, and I couldn't find any hints on how to compile this under windows.
By the way, I'm using Visual Studio C++ Express 2010.
Thanks in advance!