{"id":41,"date":"2007-10-23T22:30:00","date_gmt":"2007-10-24T05:30:00","guid":{"rendered":"http:\/\/samueldotj.com\/blog\/?p=41"},"modified":"2007-10-23T22:30:00","modified_gmt":"2007-10-24T05:30:00","slug":"notepad-as-ide","status":"publish","type":"post","link":"http:\/\/samueldotj.com\/blog\/notepad-as-ide\/","title":{"rendered":"Notepad++ as IDE"},"content":{"rendered":"<\/p>\n<p>I  have been using <a href=\"http:\/\/notepad-plus.sourceforge.net\/uk\/site.htm\">Noetpad++<\/a> for more than 2 years. It is a wonderful editor \u2013 it is very light and feature rich. I use it for editing any text files (txt, ini, C, C++, html, css..). <span> <\/span>I was happy with Notepad++ for editing my C project source files. Only thing I didn&#8217;t like was, to compile I have to go to command prompt and then to correct errors I have to note down the line numbers and open notepad++ modify\u2026.<\/p>\n<p>Yesterday, I started searching for a new notepad replacement cum IDE for my Ace(C on cygwin) project. <a href=\"http:\/\/www.bloodshed.net\/devcpp.html\">Dev-Cpp<\/a> and <a href=\"http:\/\/www.pspad.com\/\">PSPad<\/a> were IDEs I got. I downloaded and installed both of them. Here comes the problem, both are heavier than notepad++. I might have not explored well, both don\u2019t have option to run cygwin make and capture output and process it.<\/p>\n<p>So I decided to create a notepad++ plugin for my need. But before that wanted to try existing plug-ins and found NppExec. This plug-in allows to run command inside notepad++ and captures the output. It also opens a C file and goto line numbers if it was in the error output if you double click on a line containing \u201cerror:\u201d or \u201cwarning:\u201d string (I found this one accidently). Downloaded NppExec and ran \u201cmake\u201d inside it; but got what I really expected. The output of cygwin \u201cmake\u201d has relative path.<\/p>\n<p><span>i386\/io.c:19: error: `Port&#8217; undeclared (first use in this function)<br \/>make[1]: *** [i386\/io.o] Error 1<br \/>make: *** [kernel] Error 2<\/span><\/p>\n<p>Since my project make works by invoking \u201cmake\u201d inside each directory, relative path will be little complicated \u2013 so decided to use absolute path in the output of gcc warning and errors. So modified the explicit rule like following.<\/p>\n<p>$(CC) -c $(abspath $I.\/include $(CFLAGS)<\/p>\n<p><p>Out of topic &#8211; good make file <a href=\"http:\/\/make.paulandlesley.org\/autodep.html\">http:\/\/make.paulandlesley.org\/autodep.html<\/a><\/p>\n<\/p>\n<p>Now the output is like the following<\/p>\n<p><span>\/cygdrive\/e\/sam\/Ace3\/src\/kernel\/i386\/io.c:19: error: `Port&#8217; undeclared (first use in this function)<\/span> <span>make[1]: *** [i386\/io.o] Error 1<\/span> <span>make: *** [kernel] Error 2<\/span><\/p>\n<p>This output was not enough because, if I double click this line, notepad tries to open <span>c:\/ \/cygdrive\/e\/sam\/Ace3\/src\/kernel\/i386\/io.c <\/span>instead of <span>e:\/sam\/Ace3\/src\/kernel\/i386\/io.c.<\/span> <\/p>\n<p>To solve this problem the I used the following script in notepad++ run command(hotkey \u2013 F6)<\/p>\n<\/p>\n<blockquote><p><span>c:\\cygwin\\bin\\bash -l -c &#8216;cd src;make 2> err; sed -e &#8220;s@\\(\\\/cygdrive\\\/\\)\\([a-zA-Z]\\)@\\2:@g&#8221; err; rm err\u2019<\/span><\/p><\/blockquote>\n<p>Sed help: <a href=\"http:\/\/www.ibm.com\/developerworks\/linux\/library\/l-sed2.html\">http:\/\/www.ibm.com\/developerworks\/linux\/library\/l-sed2.html<\/a><\/p>\n<p>Explanation of this command:<\/p>\n<p>c:\\cygwin\\bin\\bash -l \u2013c<\/p>\n<p>Tells NppExec to execute bash and capture its ouput. \u2013l means login and execute bash scripts and profile \u2013 I need this for setup my make environment. \u2013c means execute the commands given as argument and exit. Each command is separated by semi-colon.<\/p>\n<p>cd src; \u2013 needs no explanation \u2013 not needed may be in your case.<\/p>\n<p>make 2> err; &#8211; run make and redirect errors to \u201cerr\u201d file.<\/p>\n<p>sed -e &#8220;s@\\(\\\/cygdrive\\\/\\)\\([a-zA-Z]\\)@\\2:@g&#8221; err; &#8211; find the pattern \/cygdrive\/? And replace it with \/cygdrive\/?:<\/p>\n<p>rm err \u2013 remove the error file.<\/p>\n<\/p>\n<p><a href=\"http:\/\/bp3.blogger.com\/_fvvvrkKNkOQ\/Rx7bI5LYsgI\/AAAAAAAAABk\/UE02Mj7cIEo\/s1600-h\/notepad.jpg\"><img decoding=\"async\" src=\"http:\/\/bp3.blogger.com\/_fvvvrkKNkOQ\/Rx7bI5LYsgI\/AAAAAAAAABk\/UE02Mj7cIEo\/s320\/notepad.jpg\" alt=\"\" border=\"0\"><\/a><\/p>\n<p>If double clicking on the error\/warning message is not opening the file, then try configuring NppExec&#8217;s console output filter by using the following %ABSFILE%:%LINE%: warning:* and %ABSFILE%:%LINE%: error:*<\/p>\n<div><\/div>\n<div>Now I am able to create, edit, compile and modify my project without leaving cygwin. Since I am using SVN no problem for source control also.\u00a0<\/div>\n<div><\/div>\n<div>Recently I switched to CodeLite and detail are here\u00a0<a href=\"http:\/\/samueldotj.blogspot.com\/2008\/09\/codelite-ide-for-c.html\">http:\/\/samueldotj.blogspot.com\/2008\/09\/codelite-ide-for-c.html<\/a>. CodeLite is lightweight IDE.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I have been using Noetpad++ for more than 2 years. It is a wonderful editor \u2013 it is very light and feature rich. I use it for editing any text files (txt, ini, C, C++, html, css..). I was happy with Notepad++ for editing my C project source files. Only thing I didn&#8217;t like was, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,4,14],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-softwares","category-tools","category-windows"],"_links":{"self":[{"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":0,"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/samueldotj.com\/blog\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}