LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C++ Projects? (https://www.linuxquestions.org/questions/programming-9/c-projects-149720/)

lramos85 02-23-2004 06:24 PM

C++ Projects?
 
Is there any way to make a C++ Project (or compile) using VI or VI Improved? by project I mean have a 'file1.h' and 'file1.cpp' and be able to link or compile them in some way. In Visual C++ (M$) you just click file > new > project and then add files to the project. If there is no way to do this in a Shell (VI or GVIM) does someone know of a program that can do this my I don't know if I can do this in KDevelop because its not working property. Thank You.

chewysplace 02-23-2004 06:38 PM

Yeah, theres Makefiles that do this. Theres a prog called Automake that can do what you need, but if you wish to get UBER! then check this out:
http://vertigo.hsrl.rutgers.edu/ug/make_help.html

have fun

DrOzz 02-23-2004 08:27 PM

i may have got the wrong idea by what you typed, and maybe what chewy said is what your looking for ..
but you say you want to compile it, so why don't you just type :
g++ file1.cpp
as long as file1.h is in the includes (#include "file1.h") it should compile ?

i mean you can use vi(m) to code your project and then use gcc (g++) to compile ...

again i may have got misled by what you typed, but isn't this all your looking for ?

jinksys 02-23-2004 08:36 PM

EDIT -- Didnt read entire post, stupid me.

lramos85 02-24-2004 09:50 PM

Oh, I'm so dumb I should of just tried that!! What I would do is that I brougth files originally make in Visual C++ and since it sucks it gives errors in Linux, anyways what are the programs that can compile C++ files like Kdevelop or VC++?

Thanks.

DrOzz 02-24-2004 09:57 PM

i already told you :
g++

if you are actually trying to say, what are some IDE's for coding C++ projects then kdeveolop is one, kate, emacs, Anjuta, gvim, rhide , etc, etc. .....

Marius2 02-27-2004 07:40 AM

Quote:

Originally posted by lramos85
Oh, I'm so dumb I should of just tried that!! What I would do is that I brougth files originally make in Visual C++ and since it sucks it gives errors in Linux, anyways what are the programs that can compile C++ files like Kdevelop or VC++?

Thanks.

There are some IDE, but I believe you'll stay more independently if you're only using g++/make, so it's easier to port to, say, *BSD.

g++:compiler
ln:linker
make:takes care of your projects; takes a makefile which defines which files are in your project. Sample:



#Path to the project directory
PPRJ=/home/sources/Linux.emptyproject/
PSRC=$(PPRJ)src/
PCLS=$(PSRC)classes/


#Set this if you have .h which are stored in a different location from .c/.cpp
#INCLUDEPATH=$(PSRC)/wherever/Make/
#Name of the executable
BINNAME=HELLOWORLD


#Project files
PRJOBJECTS=$(PSRC)main.o $(PCLS)class1.o $(PCLS)class2.o /usr/lib/libpthread.so

CC=g++
CFLAGS=-Wall -ggdb -I$(INCLUDEPATH)

prj: $(PRJOBJECTS)
$(CC) -o $(BINNAME) $(PRJOBJECTS)

main.o: $(PSRC)main.cpp $(PSRC)main.h
$(CC) $(CFLAGS) -c $(PSRC)main.cpp

class1.o: $(PCLS)class1.cpp $(PCLS)class1.h
$(CC) $(CFLAGS) -c $(PCLS)class1.cpp

class2.o: $(PCLS)class2.cpp $(PCLS)class2.h
$(CC) $(CFLAGS) -c $(PCLS)class2.cpp

clean:
rm -f *.o
rm -f a.out
rm -f $(BINNAME)


This expects the makefile in /home/sources/Linux.emptyproject/, main.h/.cpp in ./src, class1/2.h/.cpp in ./src/classes. At the console, just cd
to /home/sources/Linux.emptyproject/ and type make.

llama_meme 02-27-2004 08:24 AM

Quote:

g++:compiler
ln:linker
make:takes care of your projects; takes a makefile which defines which files are in your project. Sample:
ln is not the linker, ld is the linker :) Anyway, you don't actually need to use it for simple projects.

Alex


All times are GMT -5. The time now is 07:47 AM.