From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Compiling C++ in emacs Date: Thu, 13 Nov 2008 14:40:43 +0100 Organization: A noiseless patient Spider Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1226587278 2509 80.91.229.12 (13 Nov 2008 14:41:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Nov 2008 14:41:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 13 15:42:19 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L0dOg-000349-Gt for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Nov 2008 15:42:14 +0100 Original-Received: from localhost ([127.0.0.1]:49638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0dNY-0006S9-GA for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Nov 2008 09:41:04 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!feeder.erje.net!85.214.105.209.MISMATCH!news.eternal-september.org!news.motzarella.org!motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 Original-X-Trace: news.eternal-september.org U2FsdGVkX18yJB0NgSiFTDwPlCxmX5m3n9eh+HIH0hR1swrpYts8Bfw7EiiuYFmSek+VXxv2z8xU0hMUEGJ48UOonw70coIhapmSSIFFbaMYfKKULiKDKU15UXEMmALMiaFt8K54fD+7SBoiPN0Afw== Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Thu, 13 Nov 2008 13:41:08 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1/RGwN6rRUnLDYoOuhj/9FJvJNNJvmujWLQFU+BcQ5Nwg== Cancel-Lock: sha1:4HkzlHUjsYajVrpxXju9bH+2yyo= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:164400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59733 Archived-At: I have the function below which is for C. Does anyone have an extension/idea for compiling and linking C++ based on file extension? ,---- | (defun do-compile() | | (unless (or (file-exists-p "makefile") | (file-exists-p "Makefile")) | (set (make-local-variable 'compile-command) | (let ((file (file-name-nondirectory buffer-file-name))) | (format "%s -o %s %s %s %s %s" | (or (getenv "CC") "gcc") | (file-name-sans-extension file) | (or (getenv "GTKFLAGS") "`pkg-config --cflags --libs gtk+-2.0`") | (or (getenv "CPPFLAGS")"-DDEBUG=9") | (or (getenv "CFLAGS") "-std=c99 -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -g") | file))) | | ) | (compile compile-command) | ) | | `---- Thanks, r.