I am in the very first step of using Emacs as my programming environment. I run it in DOS Prompt using emacs -nw
and do the development there. It\'s quite unbel
Lots of comments:
There's no need for you to use -nw
; Emacs works fine with windows.
The analogue to build.xml is xxxxxx.sln, combined with the dependent project files, which are zzzzzzz.csproj. OF course replace xxxx and zzzzz with your solution and project names.
you don't need the eshell or shell to compile. You can run the compile from within emacs using M-x compile
which is often bound to a key combo for easy access. Mine is C-xC-e
but I don't know if that is a broad convention or just my choice.
The next-error
function works fine to move point to the next error that is reported in the compiler output. You may need a regex for error strings. I use this:
(add-to-list 'compilation-error-regexp-alist-alist '(msvc "^[ \t]\([A-Za-z0-9\.][^(]\.\(cpp\|c\|h\)\)(\([0-9]+\)) *: +\(error\|fatal error\|warning\) C[0-9]+:" 1 3)))
When there is already an msvc entry, you may need to
(let ((msvcentry (assoc 'msvc compilation-error-regexp-alist-alist )))
(when msvcentry
(setcdr msvcentry '(msvc ....)))))
you have several command line tools at your service:
.sln
files (which are like ant's build.xml files)nmake
which is an older build-system based upon Makefile
filescl.exe
and link.exe
all you have to do is launch the visual-studio-commandline prompt OR incoporate the environment of that prompt into your own shell/powershell/emacs-environment. have a look at the vcvars32.bat
file and what it does, it is located somewhere in the installation folder of visual2008.
you could also use other build systems (scons, cmake etc) which either are standalone (scons) or create native buildscripts for your compiler (cmake, would creates .sln
in your case).
to compile (and link) a simple binary which uses opengl you can do this:
% cl /nologo opengl.cpp /link OpenGL32.lib GLu32.lib and GLaux.lib
take a look at a nehe-tutorial.
In another answer to this question, @akira said:
All you have to do is launch the visual-studio-commandline prompt OR incorporate the environment of that prompt into your own shell/powershell/emacs-environment. Have a look at the vcvars32.bat file and what it does; it is located somewhere in the installation folder of visual2008.
Taking that suggestion, I have created an Emacs lisp file to set up my environment in Emacs for Visual Studio 2010. To create this file, I first captured the environment settings from an ordinary command prompt and then did the same from the Visual Studio Command Prompt:
set > set_ordinary.txt
set > set_vs2010.txt
Then, I found the differences between the two using a file differencing tool for Windows. The following emacs lisp code is the result of my effort. Just copy its content into your .emacs file, or better, save its content to vcvars32-2010.el and place it in your load-path.
;;; vcvars32-2010.el --- Create Visual Studio Command Prompt (2010) environment settings
;; Environment settings for:
;; Visual Studio 2010 Professional
;; Version 10.0.40219.1 SP1Rel
;;
;; Microsoft .NET Framework
;; Version 4.5.50938 SP1Rel
;; Reference:
;; C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat
;; -and-
;; C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\vcvars32.bat
;;; Usage:
;; Place this file somewhere in your `load-path' and add the following line
;; to your `.emacs' file:
;;
;; (load "vcvars32-2010.el")
;;; Code:
(setenv "CommonProgramFiles" "C:\\Program Files\\Common Files")
(setenv "DevEnvDir" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\")
(setenv "Framework35Version" "v3.5")
(setenv "FrameworkDir" "C:\\Windows\\Microsoft.NET\\Framework\\")
(setenv "FrameworkDIR32" "C:\\Windows\\Microsoft.NET\\Framework\\")
(setenv "FrameworkVersion" "v4.0.30319")
(setenv "FrameworkVersion32" "v4.0.30319")
(setenv "INCLUDE"
(concat
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\INCLUDE;"
"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include;"))
(setenv "LIB"
(concat
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\LIB;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\LIB;"
"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\lib;"))
(setenv "LIBPATH"
(concat
"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;"
"C:\\Windows\\Microsoft.NET\\Framework\\v3.5;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\LIB;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\LIB;"))
(setenv "Path"
(concat
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VSTSDB\\Deploy;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools;"
"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;"
"C:\\Windows\\Microsoft.NET\\Framework\\v3.5;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\VCPackages;"
"C:\\Program Files (x86)\\HTML Help Workshop;"
"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\NETFX 4.0 Tools;"
"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin;"
(getenv "Path")))
(setenv "PROCESSOR_ARCHITECTURE" "AMD64")
(setenv "ProgramFiles" "C:\\Program Files")
(setenv "VCINSTALLDIR"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\")
(setenv "VSINSTALLDIR"
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\")
(setenv "WindowsSdkDir"
"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\")
;;; vcvars32-2010.el ends here