Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with compiling
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Windsurfer




PostPosted: Sun Dec 10, 2006 2:01 pm   Post subject: 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++http://notepad-plus.sourceforge.net/ to write code. Now, i know how to use the command prompt, sort of, and how to compile and run a program. Something like
code:

g++ myprog.cpp -Wall -o myprog.exe

and then to run it, use something like
code:
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?
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sun Dec 10, 2006 2:20 pm   Post subject: (No subject)

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:

code:
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:

code:
make


And when you want to get back to a clean base to build it again:

code:
make clean
Windsurfer




PostPosted: Sun Dec 10, 2006 3:03 pm   Post subject: (No subject)

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




PostPosted: Sun Dec 10, 2006 4:28 pm   Post subject: (No subject)

Keep a cmd.exe window open. Keep a Notepad window open. Edit in Notepad++, compile in the command prompt window.
Windsurfer




PostPosted: Sun Dec 10, 2006 7:29 pm   Post subject: (No subject)

Well that's annoying. I'm sure there is a way to do it within Notepad++. I'm switching to perl instead... Razz
wtd




PostPosted: Sun Dec 10, 2006 7:43 pm   Post subject: (No subject)

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




PostPosted: Sun Dec 10, 2006 11:32 pm   Post subject: (No subject)

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




PostPosted: Sun Dec 10, 2006 11:33 pm   Post subject: (No subject)

Windows command windows can be made wider. Right-click the titlebar and select properties.
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Mon Dec 11, 2006 2:23 pm   Post subject: (No subject)

Or you can do like me and use linux Wink Variable sized terminals are wonderful!
wtd




PostPosted: Mon Dec 11, 2006 2:36 pm   Post subject: (No subject)

Yes, but one has to give Windows credit where it's due. Doing that just makes it look even less impressive, in my opinion. Smile
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: