LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-23-2004, 07:24 PM   #1
lramos85
Member
 
Registered: Sep 2003
Location: Riverside, Ca
Distribution: Gentoo, FC3
Posts: 125

Rep: Reputation: 15
Question 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.
 
Old 02-23-2004, 07:38 PM   #2
chewysplace
Member
 
Registered: Sep 2003
Distribution: Slackware 10 w/ Kernel 2.6.8
Posts: 176

Rep: Reputation: 30
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
 
Old 02-23-2004, 09:27 PM   #3
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
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 ?
 
Old 02-23-2004, 09:36 PM   #4
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 418

Rep: Reputation: 31
EDIT -- Didnt read entire post, stupid me.
 
Old 02-24-2004, 10:50 PM   #5
lramos85
Member
 
Registered: Sep 2003
Location: Riverside, Ca
Distribution: Gentoo, FC3
Posts: 125

Original Poster
Rep: Reputation: 15
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.
 
Old 02-24-2004, 10:57 PM   #6
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
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. .....
 
Old 02-27-2004, 08:40 AM   #7
Marius2
Member
 
Registered: Jan 2004
Location: Munich
Distribution: SuSE 9.2, 10.2, 10.3, knoppix
Posts: 274

Rep: Reputation: 30
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.
 
Old 02-27-2004, 09:24 AM   #8
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Projects shivaligupta Programming 1 01-31-2005 08:29 AM
Suggest some projects please vijayaraghava Linux - Software 1 01-04-2005 03:31 PM
Regarding Projects... coolguy_iiit Linux - General 1 10-07-2004 07:16 AM
modem---how-to->for projects alaios Linux - Networking 0 02-08-2004 05:36 PM
Ideas for projects in C cizzi Linux - Newbie 1 06-09-2001 04:27 AM


All times are GMT -5. The time now is 11:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration