porting MSVS proj files to makefiles? - visual-c++

Does anyone know if/how to automatically generate makefiles from a .sln/.vcproj files of a C++ application in MSVS to be used to compile and build this application on Linux ?
Thanks, --Yariv

You can create a makefile from within Visual Studio. It's not exactly the same thing as in Linux, but the numner of required modifications is not too big.
MSDN: Creating a Makefile Project

Related

Add reference to CMake project in Android Studio

In my particular case, I implemented a cross platform project in C++11 that uses CMake. I initially designed this project to work on PC (Windows, Unix), but now I realized that I can use it on mobile platforms too, without re-implementing the business logic on every platform. The project uses standard libraries: Boost, Poco, OpenSSL, Protobuf.
After a few searches I came to conclusion that this is not even an usual mode to put together native and managed code in Android.
Is it possible to add reference in a Gradle project in Android Studio to a native project that uses CMake?
Can NDK adopt the project in a simple manner if I compile everything in command line (assuming I don't use Android Studio)?
If it is possible, is it recommended at all?
Is it possible to add reference in a Gradle project in Android Studio to a native project that uses CMake?
Since Google announced Android Studio 2.2 that comes with cmake plugin, so it's possible to reference CMake project to android project.
Can NDK adopt the project in a simple manner if I compile everything in command line (assuming I don't use Android Studio)?
In my experience, i compile NDK in separate way and then link the static/shared library (.so file) to be used in android project. I used NDK while developing PDF Reader using mupdf here
Hope this helps.
it would be possible with android studio 2.2, mainly the android plugin for gradle makes it possible. you could look at some examples in:
https://github.com/googlesamples/android-ndk/tree/master-cmake
android studio directly reads-in your cmake scripts -- there is nothing like desktop systems that generate project files for their native IDEs ( Visual Studio or XCode ); so you might have to modify your existing cmake files to eventually make it to work for android studio.
as long as you build to the correct APK, command line or IDE does not matter too much. If you intend to ship source code, having your project ready with an IDE would be attractive.
Please see CMaker_Boost, build the Boost with the CMake at a configure time. Now it is tested on the Linux and Android, gcc and clang. This can be included to the gradle project in the Android Studio. I hope this helps.

FreeRTOS - Creating Project MinGW or MSVC, undefined reference to "xTaskCreate"

I'm newbie with FreeRTOS and i'm trying to compile a simply example application.
If i open the demo application with Microsoft Visual Studio, it works greatly, but once i remove all .c leave only main.c with some simply instatements like xTaskCreate(), cause this errors:
undefined reference to: xTaskCreate();
I've tried also to create a new project with include all header, but the result it's the same.
Toolchain tried: Codeblock and Eclipse Luna with MinGW header and Microsoft Visual Studio with header MSVC
I've seen that in the source file, there aren't .lib or .dll but only .h.
Thanks in advance :)
This was the solution posted on the FreeRTOS support forum:
"Don't delete any files from the "FreeRTOS Source" directory in the MSVC
project. They implement the FreeRTOS kernel, so without them your
application will not link."

Makefiles for Microsoft Visual C++

I have few queries regarding makefiles for MSVC. I want to create makefiles which will compile my project on Visual C++ compiler. One thing I found in the web named "nmake" which is said to be the makefiles for MSVC(correct me if I am wrong).
So, I introduced myself with nmake and compiled a single source file successfully with this. But the issue is, I need to run this nmake file using command prompt of visual studio. I haven't found a way to use the file in normal command prompt. Is it really possible?
Suppose, I don't have a visual studio installed. I have only the visual C++ compiler. Then how I will be able to compile my projects using nmake?
One Additional question, if I have only visual C++ compiler installed(like the old compilers eg. microsoft visual C++ 2005), then is it certain that I will get nmake command on this?
Thanks in advance.
Solved! Answering myself, so that if anyone intend to compile makefiles using nmake for Visual C++ compiler.
Yes, it is compiles in older version of visual C++ also. I have tested and it works fine. But it may cause problems when some properties are use of latest visual C++ compiler. Because you will not find those properties in older version of C++ compiler. Otherwise it is quite OK.

How do I make Microsoft Visual C++ 2010 Express executable files independent of c++

Whenever I try to build a windows executable file in Microsoft Visual C++ 2010 Express and use the created program, Microsoft Visual C++ always boots up, I want to create an executable file, just like any other windows program without having to go through Microsoft Visual C++. Any information on this would be GREATLY appreciated, Thank You
When you have build you program you have to copy the executable to the destination PC. When your C++ program is in the file hello.cpp compiled in the project moin.vcproj yoi have to copy the moin.exe to the target. There you start the moin.exe. The executable can be placed in any folder.
The C++ compiled program requires that the C++ run-time library is installed. Very often it's already there. But you have problems to run the executable you need to install the correct redistributable package.
Depending on the target CPU you used you need the x86 or the x64 distributable:
Edit: If you don't want to deploy your program you just use the Windows Explorer, browse to the folder where Visual Studio has created the moin.exe, and double start it with a double click. The right mouse key can offer you more possibilities like creating a shorcut.
The search function of the Explorer might help here. If you didn't change the output directory you will find the .exe somehwere below the place where your .vcproj is located.

Use Clang with MSVC 2010

First of all, I want to ask if Clang compiler is better than MSVC's default compiler? And how can I use Clang with MSVC? For example, I write code in MSVC then when I hit Build, it call Clang to build the project.
https://github.com/ishani/ClangVSx
AddIn for Visual Studio 2010 that allows use of the Clang C/C++ compiler in place of MSVC++. Translates VC project and build settings into gcc-friendly command line arguments, along with existing platform tools (MSVC Linker, Librarian, RC) to complete the build chain.
Using clang compiler on Windows is still considered to be in experimental state. However, some progress has been made recently. As I answered similar question:
LLVM provides Windows snapshot builds - a clang toolset for Visual Studio as Windows installer. Currently it should integrate with Visual Studio 2010, 2012 and 2013. More information can be found on LLVM's blog post A path forward for an LLVM toolchain on Windows.
You can use a "makefile project" to have Visual Studio invoke a makefile (or any command-line process) when you tell it to build.
I've done this before to get MSVC's nice source navigation for non-Windows embedded projects.
The drawback is that you have to manually keep the makefile in sync with the files in the project (or vice-versa depending on how you want to look at it) - generally not a huge problem.

Resources