roshanvid
roshanvid

Reputation: 793

Clojure Hello World - "No such namespace" error

I'm trying to write a helloworld with clojure. I'm using leinengen with emacs and swank-clojure.

Here's what my src/hello.clj contains:

(ns hello)

(defn hello []  
(println "Hello World"))

When I clojure-jack-in and C-c C-c over the function, I get:

No such namespace: hello                                                   
[Thrown class java.lang.Exception]  

What am I doing wrong?

Upvotes: 2

Views: 1488

Answers (1)

sanityinc
sanityinc

Reputation: 15212

With C-c C-c, you're asking the backend to compile the function at point within the "hello" namespace, but that namespace doesn't yet exists -- you haven't executed the (ns hello) line yet. So try C-c C-k instead, which will compile the entire file. Thereafter, C-c C-c will allow you to re-compile the function.

Upvotes: 5

Related Questions