emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Problem compiling C++ in Org-mode


From: Michael Hannon
Subject: Re: [O] Problem compiling C++ in Org-mode
Date: Fri, 18 Nov 2011 21:13:42 -0800 (PST)


> From: Sebastien Vauban <address@hidden>
>> Just for the record, adding the following to my .emacs file seems to solve
>> the problem I was having, where the C++ compiler was compiling a source
>> block (written  to a temporary file in /tmp/...) and was unable to find an
>> include file in the current working directory:
>>
>> (setq org-babel-C++-compiler
>>     (concat "g++ -std=c++0x "
>>             "-I"
>>             (expand-file-name ".")
>>     )
>> )

> Your previous version contained "-I~/...". I don't know why you changed it,
> but this could eventually enlighten you:
> 
>     ┏━━━━[ from Cygwin's ML]
>     ┃ "If a word begins with an unquoted tilde character (`~'), all of the
>     ┃ characters up to the first unquoted slash (or all characters, if there
>     ┃ is no unquoted slash) are considered a TILDE-PREFIX."
>     ┃
>     ┃ Note "word begins". I've been bitten by this in a makefile:
>     ┃
>     ┃ OPENSSL_DIR := ~/lib/openssl
>     ┃ CPPFLAGS := -I$(OPENSSL_DIR)
>     ┃
>     ┃ The gcc command line then contained -I~/lib/openssl, and the ~ was not
>     ┃ expanded by the shell. ${HOME}/lib/openssl would have worked.
>     ┗━━━━
> 

Hi, Seb.  Thanks for the heads-up.  The version that I have now seems to work,
but, just FYI, the explanation for the change of syntax is explained in the
little dialogue that I had with myself:

Hmm, to get this thing to compile, I have to tack on some "-I..." stuff to my
g++ command.  This is tedious.  How can I do this automatically?

I'll bet I know: there must be some way to concatenate strings in Emacs lisp.

(Google search for some terms vaguely related to "Emacs lisp concatenate".)

(Look at one of the Google hits and stumble across an example that turns out
to use "expand-file".)

What do you suppose expand-file does?  (Try it.)  Cool!

(Break from problem-solving loop)

-- Mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]