• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

problems, beginning?

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...
1 Solution
could you plese post the exact messages from gcc
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"
DeproGAuthor Commented:
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?
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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
DeproGAuthor Commented:
uhh, call me stupid but I can't run the file... what should I do?
what does following report:

    ldd yourfile

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
DeproGAuthor Commented:
It worked when I used the ./my_executable... thanks :)
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.
DeproGAuthor Commented:
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 :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now