Solved

problems, beginning?

Posted on 2002-04-05
10
212 Views
Last Modified: 2010-04-22
I've just started programming on Linux (Best Linux 2000) using C++ and have occured some problems which seem to be residing in the lib iostream. That the operator << wants a constant but when it gets one it complains about the length of it... I'm confused about this, since the code has worked on Windows XP with Dev-C++. Tried both make and gcc, make seems to not understand C++ files and gcc reports the error in iostream. Any ideas are highly appreciated, cause I'm not getting anywhere with this...
0
Comment
Question by:DeproG
10 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6921743
could you plese post the exact messages from gcc
0
 
LVL 5

Expert Comment

by:garboua
ID: 6922782
what do you mean by gcc? are you actually invoking gcc on c++ file or you refereing to gcc as the "gnu compiler collection"
check to see if you have a C++ compiler first?  
g++ -c test.cpp
if you have the C++ compiler what version are you running
"g++ -v" will do that for you.
I have done little with C++ on MSW using VC++ and there is NO difference between the iostream "library"
0
 

Author Comment

by:DeproG
ID: 6922794
on g++ -v ut returns:
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

It appears to compile and link correctly with the g++ command (sorry 'bout that), but what is this a.out for?
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 4

Expert Comment

by:ct.smith
ID: 6923123
a.out is the name of your executable.

If you want to specify a different name, say 'myprogram, you can do:

g++ test.cpp -o myprogram
0
 

Author Comment

by:DeproG
ID: 6923136
uhh, call me stupid but I can't run the file... what should I do?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6923150
what does following report:

    ldd yourfile
0
 
LVL 4

Accepted Solution

by:
newmang earned 50 total points
ID: 6924341
DeproG

I know this is obvious but if the executable is not in a directory on your path (echo $PATH to check) then you have to provide an explicit path when running the file.

For example you may need to type ./my_executable

Some people add the . directory on the end of theor path so the current directory is always in their path but this is a security exposure and should be avoided.

Cheers - Gavin
0
 

Author Comment

by:DeproG
ID: 6925303
It worked when I used the ./my_executable... thanks :)
0
 
LVL 4

Expert Comment

by:IainHere
ID: 6933523
Also, try 'man make', and find out what it is for.  For the most part, you wont want to invoke g++ directly, because linking everything together, and remembering which files need updating gets tedious.

From your original question, it seems that you think 'make' is a compiler, but it is actually a tool to aid you in compiling.
0
 

Author Comment

by:DeproG
ID: 6936996
yeah, I've found it out now, and also how to get make using g++ for compilation, so it's working now... thanks for the help all of you :)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linux script help 27 256
Avoiding pop-up when starting a linux scrip/shell 5 101
Linux Search 3 67
Set-Top-Box hardware and Open Source! 8 191
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now