![]() |
| | #1 |
| ------------ Join Date: Jun 2005
Posts: 79
| compile program? c++ (program name.cpp) -o (program name) -Wall -O2 just to compile it and wanted to know if there was a program that cam automatically make it so when i type something like: compile (program.cpp) it automatically adds in the extra info? i know it can be coded in c++ but i dont know how to do that yet and wanted to know if there was one already written?
__________________ CAUTION: Newbie at programming! ------------------------------------------------- Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated ![]() |
| Goosie is offline | |
| | #2 |
| Registered User Join Date: Jun 2005 Location: Maryland, USA
Posts: 212
| echo "c++ (program name.cpp) -o (program name) -Wall -O2" > batch.sh chmod 700 batch.sh ./batch.sh Or learn to make 'make' files.
__________________ Free code: http://sol-biotech.com/code/. It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it. --Me, I just made it up The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man. --George Bernard Shaw |
| mitakeet is offline | |
| | #3 |
| Registered User Join Date: Mar 2002
Posts: 1,595
| You could always download the latest version of Dev-C++. It's an Integrated Development Environment (IDE), which is a fancy way of saying you don't need to use command line statements, do your own linking, etc. You just select the type of project you want to work on, write your code in the text editor, click the compile button, and if you don't get any errors, click the execute button and see if you get the desired behavior or a run time error. Works smooth as silk (well, most of the time anyway). Oh, and did I mention; it's free.
__________________ You're only born perfect. |
| elad is offline | |
| | #4 |
| ------------ Join Date: Jun 2005
Posts: 79
| I was thinking about using an IDE but i was told by a ton of people that it does some of the work for you other than compile, and makes you not do some of the work... I wanted to make sure that I actualy know how to do everything that my program is doing... its OK, i guess it isnt that bad to type that to compile a program...
__________________ CAUTION: Newbie at programming! ------------------------------------------------- Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated ![]() |
| Goosie is offline | |
| | #5 | |
| Registered User Join Date: Apr 2003
Posts: 2,662
| Quote:
Do you feel that using a card punch machine to make a stack of 1,000 punch cards representing your program, which you leave in the inbox at your computer center overnight, and then return the next day or maybe the day after that to get the results produced by your program when after the computer operator fed your punch cards into the computer would also teach you something? Last edited by 7stud; 06-22-2005 at 01:40 PM. | |
| 7stud is offline | |
| | #6 |
| ------------ Join Date: Jun 2005
Posts: 79
| nothing, but they said that the IDE's will add stuff to the program that I didnt put there. and by it doing that it might add something and I dont know how to do...
__________________ CAUTION: Newbie at programming! ------------------------------------------------- Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated ![]() |
| Goosie is offline | |
| | #7 | |
| Registered User Join Date: Apr 2003
Posts: 2,662
| Quote:
![]() I click on a compile button and a run button everytime I execute a C++ program, and yet I have still been able learn about pointers, classes, inheritance, and polymorphism. Don't tell anyone, but I also use the following template for every program so I don't have to type it every time: Code: #include <iostream>
using namespace std;
int main()
{
return 0;
}
Last edited by 7stud; 06-22-2005 at 01:46 PM. | |
| 7stud is offline | |
| | #8 |
| ------------ Join Date: Jun 2005
Posts: 79
| UFO's do land on earth everyday! they stole my uncle... ![]() well, i guess i might go and try one out
__________________ CAUTION: Newbie at programming! ------------------------------------------------- Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated ![]() |
| Goosie is offline | |
| | #9 |
| myNegReal Join Date: Jun 2005
Posts: 100
| Dev-C++ is great, and like most IDE's, there's also Compile+Run buttons. As long as your program won't cause any compile time errors, click one buttons, it compiles and right after is automatically executed. I've always used IDE's never bothered with that command line compiling. |
| Ganoosh is offline | |
| | #10 |
| #include<xErath.h> Join Date: Jun 2004
Posts: 724
| you're in luck. I made a great makefile that compiles all source files it can find and link then in a final application. Currently it only works for *.cpp file.. I stil haven't added suport to mix *.c files... here it is Code: DIRS := ./ src/ OBJDIR := obj/ EXE = app #all .cpp/.c SRC := $(filter %.cpp, $(foreach DIR,$(DIRS),$(wildcard $(DIR)*.cpp) )) #all headers with matching .cpp/.c HDR := $(filter $(foreach DIR, $(DIRS),$(wildcard $(DIR)*.h)),$(patsubst %.cpp,%.h,$(SRC))) #all .o from a .cpp/.c OBJ := $(foreach FOBJ,$(filter %.o, $(patsubst %.cpp,%.o,$(SRC))),$(OBJDIR)$(FOBJ) ) #all .h with matching .o HOBJ := $(foreach FOBJ,$(filter %.o, $(patsubst %.h,%.o,$(HDR)) ),$(OBJDIR)$(FOBJ) ) #all .o without matching .h COBJ := $(filter-out $(HOBJ),$(OBJ)) FLAGS = -Wall $(EXE): $(OBJ) $(CXX) $(FLAGS) $(OBJ) -o $(EXE) $(HOBJ): $(OBJDIR)%.o: %.cpp %.h -@mkdir -p $(OBJDIR)$(dir $(filter %.cpp, $^)) @touch -a $@ $(CXX) $(FLAGS) -c $(filter %.cpp, $^) -o $@ $(COBJ): $(OBJDIR)%.o: %.cpp -@mkdir -p $(OBJDIR)$(dir $<) @touch -a $@ -$(CXX) $(FLAGS) -c $< -o $@ #clean .PHONY : c clean c clean: @echo cleaning temporaries -@rm -f $(EXE) $(OBJ) $(foreach DIR,$(DIRS),$(DIR)*.bak "$(DIR)*.*~" ) -@rmdir -p --ignore-fail-on-non-empty $(filter-out $(OBJDIR)./,$(foreach DIR,$(DIRS),$(OBJDIR)$(DIR) )) To compile just write 'make' at the commad prompt. Add/remove directories to the DIRS variable to mntion where your code is Change EXE variable to your liking. That's the exeutable final name |
| xErath is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Program Plan | Programmer_P | C++ Programming | 0 | 05-11-2009 01:42 AM |
| Compile Public Domain Pocket PC C Program | m1l | Projects and Job Recruitment | 2 | 07-20-2007 04:02 AM |
| Using variables in system() | Afro | C Programming | 8 | 07-03-2007 12:27 PM |
| new to C--can't get program to compile | samerune | C Programming | 12 | 04-02-2007 09:44 AM |
| how do i compile a program that deals w/classes? | Shy_girl_311 | C++ Programming | 5 | 11-11-2001 02:32 AM |