Domanda

I know there have been a few posts on the topic but didn't get a satisfying answer:

I develop C++ code and use CMake as a build system. I usually work in a Linux environment. Now I want to port my code to windows, and be able to edit and compile it within emacs.

I generate "NMAKE Makefiles" with CMake. This works fine but only if I run nmake from "Visual Studio Command Line". Visual Studio Command Line is like the regular Windows command line, with a bunch of environment variable set up. If I run nmake from the regular windows command line, I end up with "nmake: unrecognized command" (not exactly the error message this is an approximate translation from french).

Following the old documentation in emacs wiki I found the .bat file which sets up the variables. If I run the .bat from regular command line then call nmake, it works. But when I run name from emacs, it just run the program as in a plain, regular command line, which knows nothing about nmake and the environment variables.

How can I make everything works together then?

È stato utile?

Soluzione

The best approach would be to write a bat file, which contains the necessary settings like this:

call "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"

nmake

and then call this file from emacs instead of the plain "nmake" command. This redoes the initialization every time, but should be fast enough.

Altri suggerimenti

Found another solution: launching emacs from the command line using Visual Studio Command Line, and all the variables and paths are good within emacs.

I also set up my .emacs as suggested by Cheeso in this related question .

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top