LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 11-13-2003, 03:35 PM   #1
leroy27336
Member
 
Registered: Nov 2003
Distribution: LTS Ubuntu 6.06
Posts: 127

Rep: Reputation: 15
Free C++ Compiler


anyone know any good, free c++ compiler for the linux workstation??
 
Old 11-13-2003, 03:49 PM   #2
dakensta
Member
 
Registered: Jun 2003
Location: SEUK
Distribution: Debian & OS X
Posts: 194

Rep: Reputation: 35
Is this a trick question?

g++ as part of gcc (Gnu Compiler Collection) is very likely already installed, and if not certainly available as part of your distro.
 
Old 11-13-2003, 04:17 PM   #3
leroy27336
Member
 
Registered: Nov 2003
Distribution: LTS Ubuntu 6.06
Posts: 127

Original Poster
Rep: Reputation: 15
ok i just installed it......however just running a little test program i'm wondering why i'm getting so many damn errors with this this little bitty piece of code.

#include <iostream>
using namespace std;


int main()
{

cout <<"Hello World\n";

return 0;

}

i'm getting errors such as this one:

undefine reference to 'std::cout' but also many others as well.
 
Old 11-13-2003, 04:21 PM   #4
leroy27336
Member
 
Registered: Nov 2003
Distribution: LTS Ubuntu 6.06
Posts: 127

Original Poster
Rep: Reputation: 15
it alos syas iostream no such file or directory
 
Old 11-13-2003, 04:26 PM   #5
leroy27336
Member
 
Registered: Nov 2003
Distribution: LTS Ubuntu 6.06
Posts: 127

Original Poster
Rep: Reputation: 15
is there another library where the cout function is defined in or what.....it's not liking "using namespace std"
 
Old 11-13-2003, 04:42 PM   #6
mr_segfault
Member
 
Registered: Oct 2003
Location: Australia
Distribution: Redhat 9
Posts: 95

Rep: Reputation: 15
Did you compile with g++ or gcc?

You must use g++

Cheers
 
Old 11-13-2003, 04:48 PM   #7
leroy27336
Member
 
Registered: Nov 2003
Distribution: LTS Ubuntu 6.06
Posts: 127

Original Poster
Rep: Reputation: 15
ok so now when i try to run it does it say:

permission denied

i'm using the command ./test.c

thanks for your help
 
Old 11-13-2003, 04:50 PM   #8
leroy27336
Member
 
Registered: Nov 2003
Distribution: LTS Ubuntu 6.06
Posts: 127

Original Poster
Rep: Reputation: 15
nevermind....i noticed that it created a new binary file with a differnt name...how do i compile it so it will create either the name of the .c file i compile or a name of my choosing.....
 
Old 11-13-2003, 04:54 PM   #9
leroy27336
Member
 
Registered: Nov 2003
Distribution: LTS Ubuntu 6.06
Posts: 127

Original Poster
Rep: Reputation: 15
also what i really wanted to know was if there was a 3rd party c++ program...one like bloodshed dev c++.....one that will auto format for me, and show nice little blue italicized postcondition and precondition remarks.......one that will turn the cout statements into nice little red words......just one that is better then g++....i do appreciate all your help and quick replys......
 
Old 11-13-2003, 05:17 PM   #10
amos
Member
 
Registered: Dec 2002
Location: Bolton, UK
Distribution: Kubuntu
Posts: 224

Rep: Reputation: 30
Open kwrite or kate.

Save your blank document as helloworld.cpp (or something similar ending with .cpp).

Type in your code, it'll be coloured.

When you've finished and saved. In the directory where you've saved it at the command prompt type:

g++ -o hello.exe helloworld.cpp

This should produce an executable called hello.exe (it doesn't need an exe extension). To execute it type hello.exe at the prompt.

If you want more then start looking at kdevelop.

Doesn't bloodshed dev-c++ use a port of gcc/g++ to compile anyway.

Cheers
Amos

Last edited by amos; 11-13-2003 at 05:20 PM.
 
Old 11-13-2003, 09:14 PM   #11
Skyline
Senior Member
 
Registered: Jun 2003
Distribution: Debian/other
Posts: 2,104

Rep: Reputation: 45
Quote:
how do i compile it so it will create either the name of the .c file i compile or a name of my choosing.....
Save your code in an ordinary text file as:

sourcefile.C

(capital C)

Then to get an executable with the same name without the .C extension do

g++ path_to_sourcefile.C -o sourcefile

Here.. the executable is created in your current working directory.

....... and for a different name.. simply

g++ path_to_sourcefile.C -o executable_name
 
  


Reply



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
Free C++ Compiler? JudasMaccabeus Linux - Software 2 11-03-2005 12:28 AM
Free C++ Compiler? BrutualTarget Programming 13 08-22-2004 04:04 PM
Free C/C++ Compiler for Windows? testforechozero Programming 6 08-19-2004 09:29 PM
free c/c++ compiler w/ directx/opengl js_530 Programming 9 07-27-2003 02:33 PM
best free C++ compiler bobbinbrisco Programming 1 07-22-2001 04:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:55 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration