
-----------------------------------
Windsurfer
Sun Dec 10, 2006 2:01 pm

Help with compiling
-----------------------------------
Hi
Maybe this should belong in general... but...
In my programming class, we use Dev C++. All we've been taught about this API is to use F9 to compile and run.
However, I would like to use Notepad++
g++ myprog.cpp -Wall -o myprog.exe
and then to run it, use something like
start myprog.exe
(PS i'm running WinXP)
Now, it works, sure, but it is tedious compared to just pressing F9. I was hoping someone knew how i could, in windows, compile and run in one line.
The reason I want it in one line is so that I can integrate the g++ compiler with Notepad++.
Anyone know?

-----------------------------------
wtd
Sun Dec 10, 2006 2:20 pm


-----------------------------------
First off, you only need to type "myprog" to execute the resulting executable.

Secondly, you can create makefiles to make this whole process potentially simpler.

Your makefile would look something like:

CC = g++
LN = g++

CXX_FLAGS = -Wall

EXE_NAME = myprog.exe
DELETE = del

all : myprog

myprog : myprog.o
	${LN} myprog.o -o ${EXE_NAME}

myprog.o : myprog.cpp
	${CC} ${CXX_FLAGS} myprog.cpp -o myprog.o

clean :
	touch myprog.o
	touch ${EXE_NAME}
	${DELETE} myprog.o ${EXE_NAME}

Then you can build your app with a simple:

make

And when you want to get back to a clean base to build it again:

make clean

-----------------------------------
Windsurfer
Sun Dec 10, 2006 3:03 pm


-----------------------------------
Uhm, okay... and I need to get "GNU make" for this? and how do I apply this to a program like Notepad++ as a shell command?

-----------------------------------
wtd
Sun Dec 10, 2006 4:28 pm


-----------------------------------
Keep a cmd.exe window open.  Keep a Notepad window open.  Edit in Notepad++, compile in the command prompt window.

-----------------------------------
Windsurfer
Sun Dec 10, 2006 7:29 pm


-----------------------------------
Well that's annoying. I'm sure there is a way to do it within Notepad++. I'm switching to perl instead... :P

-----------------------------------
wtd
Sun Dec 10, 2006 7:43 pm


-----------------------------------
Perl's a fine language too.

But not having a fancy IDE isn't a huge issue.  Plus, it doesn't get much more simple than a text editor and a command-line.

-----------------------------------
md
Sun Dec 10, 2006 11:32 pm


-----------------------------------
text editor + command line is great. The only problem I have is that terminal windows are too small at 8- characters wide, errors are much easier to read when they are not spread over 6 lines.

-----------------------------------
wtd
Sun Dec 10, 2006 11:33 pm


-----------------------------------
Windows command windows can be made wider.  Right-click the titlebar and select properties.

-----------------------------------
md
Mon Dec 11, 2006 2:23 pm


-----------------------------------
Or you can do like me and use linux ;-) Variable sized terminals are wonderful!

-----------------------------------
wtd
Mon Dec 11, 2006 2:36 pm


-----------------------------------
Yes, but one has to give Windows credit where it's due.  Doing that just makes it look even less impressive, in my opinion.  :)
