LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy
User Name
Password
Puppy This forum is for the discussion of Puppy Linux.

Notices


Reply
  Search this Thread
Old 02-11-2012, 01:25 PM   #1
Atharv Patil
Member
 
Registered: Jan 2012
Location: Pune, Maharashtra, India
Distribution: Ubuntu, LFS, PC Linux OS, Puppy
Posts: 36

Rep: Reputation: Disabled
Question Compiling and running programs in Lucid Puppy 2.5.2


I have downloaded devx and configured it with puppy and it works well. But i cannot compile and run c++ programs. I used the g++, but it always shows sum error even if everything is correct. I think that the libraries for c++ are old and so i am downloading latest release of gcc. Will it help me compiling and running c++ programs? If no, then how do i do it? And how do i add other programming languages in my puppy, like latest ver of python, ruby and some other languages?
 
Old 02-12-2012, 09:51 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Atharv Patil View Post
I have downloaded devx and configured it with puppy and it works well. But i cannot compile and run c++ programs. I used the g++, but it always shows sum error even if everything is correct.
Spell out your words. And if everything is correct, you won't have errors.
Quote:
I think that the libraries for c++ are old and so i am downloading latest release of gcc. Will it help me compiling and running c++ programs? If no, then how do i do it? And how do i add other programming languages in my puppy, like latest ver of python, ruby and some other languages?
No idea, since you don't tell us what error(s) you're getting. Also, you say you're using "Lucid Puppy 2.5.2"?? That's VERY old, and quite likely unsupported...the latest version is 5.2.8. The best way to get everything correct, is to do a fresh install of a current version of Linux. Python, ruby, and 'other languages' will be automatically installed/updated, as will g++ and development libraries.

If you mean you're using 5.2.5, have you looked at LucidPuppyUpdate?? You can update things online.
http://puppylinux.org/wikka/LucidPuppyUpdate

Last edited by TB0ne; 02-12-2012 at 09:54 PM.
 
Old 02-13-2012, 11:47 PM   #3
Atharv Patil
Member
 
Registered: Jan 2012
Location: Pune, Maharashtra, India
Distribution: Ubuntu, LFS, PC Linux OS, Puppy
Posts: 36

Original Poster
Rep: Reputation: Disabled
Sorry, i am actually using puppy 5.2.5. Given below a program i tried to compile using g++

#include<iostream.h>
void main()
{
cout<<"hello";
}

there might be errors in the above program but the one i tried to compile was 100% correct. When i compiled it, it gave errors. 1 related to the main(), 1 related to cout. I cannot tell what were the actual errors because i am posting this reply via cell phone. What can be the problem?
 
Old 02-14-2012, 12:05 AM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
Well, without the output it's hard to say. But you're doing at least three things which are weird.

1. You should say iostream, not iostream.h.
2. The main signature usually returns int.
3. You need to specify a scope for cout.

Code:
#include <iostream>

int main(void) {
    std::cout << "Hello, world.\n";
    return 0;
}
 
1 members found this post helpful.
Old 02-14-2012, 10:03 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Atharv Patil View Post
Sorry, i am actually using puppy 5.2.5. Given below a program i tried to compile using g++
Code:
#include<iostream.h>
void main()
{
cout<<"hello";
}
there might be errors in the above program but the one i tried to compile was 100% correct. When i compiled it, it gave errors. 1 related to the main(), 1 related to cout. I cannot tell what were the actual errors because i am posting this reply via cell phone. What can be the problem?
Well again, if the code was 100% correct, you wouldn't get errors. Errors are a good indication that there is a problem.....have you tried to compile/run any OTHER C++ programs, aside from the one you posted/wrote??
 
Old 02-15-2012, 01:47 AM   #6
Atharv Patil
Member
 
Registered: Jan 2012
Location: Pune, Maharashtra, India
Distribution: Ubuntu, LFS, PC Linux OS, Puppy
Posts: 36

Original Poster
Rep: Reputation: Disabled
I did not use the conventions you posted earlier, i used the traditional iostream.h and void main(). I think that must be the problem. Is it the Linux convention that main should return int and the header file should be iostream and not iostream.h?
 
Old 03-30-2012, 09:15 AM   #7
WarTurkey
Member
 
Registered: Jun 2009
Posts: 67

Rep: Reputation: 16
No, this is standard C++ conventions:

http://www.cplusplus.com/doc/tutoria...ram_structure/
Code:
// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}
http://en.wikipedia.org/wiki/C%2B%2B
Code:
#include <iostream>
 
int main()
{
   std::cout << "Hello, world!\n";
}
http://www.cprogramming.com/tutorial/lesson1.html
Code:
#include <iostream>
 
using namespace std;
 
int main()
{
  cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
  cin.get();
}

Last edited by WarTurkey; 03-30-2012 at 09:17 AM. Reason: After hitting "Post," I figured perhaps I shouldn't have posted this, but I cannot delete it!
 
  


Reply

Tags
compile, language, programming, run



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
LXer: Puppy 5.1 “Lucid Puppy” Review LXer Syndicated Linux News 0 08-15-2010 06:50 PM
LXer: Puppy 5.1 codename Lucid is out- Now is compatible with Ubuntu 10.04 Lucid Lynx package LXer Syndicated Linux News 0 08-15-2010 02:20 PM
LXer: Western Digital Scorpio Black 320 GB hard drive dying ... so I'm running Lucid Puppy in the in LXer Syndicated Linux News 0 07-23-2010 04:00 PM
compiling and running gtk programs in linux gibin Linux - Newbie 1 06-24-2010 02:46 PM
Lucid Puppy 5.0.1 riki Linux - Laptop and Netbook 3 05-31-2010 03:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy

All times are GMT -5. The time now is 07:04 PM.

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