hi,

I'm beginning to learn how to program in C++ and though it is teached in my university, it seems noone cares about Linux users, so no one there can help me here (though I think the problem has nothing to do with my OS, but with the version of the program I use: eclipe)

the problem is the following:

http://img409.imageshack.us/img409/9127/eclipse1da1.png

when I try to run this, this new window pops up and I've filled the necessary camps as far as I could, but I don't know what to put where it says "C/C++ Application:"

http://img184.imageshack.us/img184/5857/eclipse2cc8.png

when I click "Search Project" that right side window pops up empty... what am I doing wrong?

thanks in advance,

onemanclapping

PS: sorry for the bad english, I'm portuguese

Recommended Answers

All 19 Replies

I have not used eclipse, so I don't know exactly what steps are needed. But I don't think there is any problem with your eclipse version. Looks like you are adding the source file to the .settings folder. Also the file does not have the extension of a C++ source file.

Try right clicking on the project name and see if there is an option like add source file . If there isn't, try reading the manual of eclipse. Doesn't matter which OS you use, the basic steps should be the same. So even the Windows Manual for eclipse would do.

I have not used eclipse, so I don't know exactly what steps are needed. But I don't think there is any problem with your eclipse version. Looks like you are adding the source file to the .settings folder. Also the file does not have the extension of a C++ source file.

Try right clicking on the project name and see if there is an option like add source file . If there isn't, try reading the manual of eclipse. Doesn't matter which OS you use, the basic steps should be the same. So even the Windows Manual for eclipse would do.

I tried all that but nothing worked... btw, the source file is not in the .settings folder:

http://img262.imageshack.us/img262/3318/screenshotfy0.png

I changed the extension to "cpp", it that right? if it is, that's not the problem either :(

do you know another application to program, compile and run C++ programs under linux?

code::blocks is a good IDE
If you just want to compile a program
use the g++ compiler
on the command line:
g++ myprog.cpp -o myprog
this will compile myprog.cpp source into myprog executable.

To run it ;
./myprog

Create a source folder. File->New->Source folder. Call it src and save your file there.

Then when that windows comes up when you try to run your program, browse to your debug folder and select the program.

Create a source folder. File->New->Source folder. Call it src and save your file there.

Then when that windows comes up when you try to run your program, browse to your debug folder and select the program.

now it says "Program is not a recognized executable." selecting the program as you told me (/home/omc/workspace/teste/src/atum.cpp)

code::blocks is a good IDE
If you just want to compile a program
use the g++ compiler
on the command line:
g++ myprog.cpp -o myprog
this will compile myprog.cpp source into myprog executable.

To run it ;
./myprog

where can I download code::blocks? the main site seems not to have anything to download: http://www.codeblocks.org/downloads/15

I'd really prefer a program that would compile itself as it would be very boring to keep repeating that code line (g++ myprog.cpp -o myprog)...

atum.cpp is a source file, not an executable file. You should locate the program you have compiled i.e. the executable file.

atum.cpp is a source file, not an executable file. You should locate the program you have compiled i.e. the executable file.

that's what I imagined...but where can I compile it under eclipse? is it the "build" option? I've already selected it but it seems not to create any kind of executable file

Try this link
http://wiki.codeblocks.org/index.php?title=Compiled_packages_of_Code::Blocks

That's the ORIGINAL codeblocks. To get the latest and greatest, you need to acquire a "nightly build" for your OS. The Linux builds tend to lag behind the windows builds a bit, but maybe just a week.

These builds are bug fixes and updates. i've found them to be very stable...at least for what I'm doing...
I found it to be a very intuitive IDE.
Try:
http://forums.codeblocks.org/index.php?PHPSESSID=85c0e2ca91c0f7599aba32825e1ffa31&board=20.0

It defaults to building your program when you save a file in the project. Once you've done that you select the executable to run it.

If you have a source folder and a source file under that folder with a main() function, it will build when you save the file.

it seems not to have a linux(ubuntu) version :(

can you or anyone else recommend me another program that works on ubuntu?

Eclipse works quite well. :) You'll have to learn to use any program you try. Since you have eclipse and it works well, I would recommend you fix your problem with it.

Did you try what I suggested before by creating a source folder?

Eclipse works quite well. :) You'll have to learn to use any program you try. Since you have eclipse and it works well, I would recommend you fix your problem with it.

Did you try what I suggested before by creating a source folder?

my teacher also sugests me Eclipse...both for windows and linux...but I'm new to this application and have know idea where the problem is...

I guess on that Run menu, where they ask for the "C++ Application" I'm not putting the right thing...but I cant find any executable files on these folders :S

it seems not to have a linux(ubuntu) version :(

can you or anyone else recommend me another program that works on ubuntu?

Try a GENERIC linux build. It should work fine.
I have Fedora, so I can use the RPMs, which are easy.
I think Ubuntu was built on debian? They may have some kind of package system as well. However, i found that it's not nearly as well supported as the Redhat/fedora flavors. That's why I use fedora. Redhat/fedora also has YUM,
which is an update manager that does a very good job of resloving dependencies for complex packages.

Code::blocks should wok OK as a stand-alone install. Do you know haow to use tar?

I don't have the program on this computer but I'll try to explain exactly what you need to do to create a simple program:

Start Eclipse
File->New->Create a managed C++ project
Right click on the project name in the left panel and go to new and create a new source folder. Name the folder src.
Right click on the source folder and create a new source file. End the file with .cpp.
In that source file, create a simple program with a main() function.
Save the file and Eclipse should automatically build the project.
A dialog window should come up and ask you something about a profile. You can create a new one and point it to the executable with the same name as the source file that you create but without .cpp.

Try a GENERIC linux build. It should work fine.
I have Fedora, so I can use the RPMs, which are easy.
I think Ubuntu was built on debian? They may have some kind of package system as well. However, i found that it's not nearly as well supported as the Redhat/fedora flavors. That's why I use fedora. Redhat/fedora also has YUM,
which is an update manager that does a very good job of resloving dependencies for complex packages.

Code::blocks should wok OK as a stand-alone install. Do you know haow to use tar?

You should try Ubuntu again if that's your opinion. Nothing wrong with Fedora but Ubuntu has excellent support. apt-get is the default package manager.

PROBLEM SOLVED :D

the problem was with the g++ version I had installed...I reinstalled it and voila! it started working.

thank you all for your kind help...I guess I'll be around here a lot more now as I'm a total beginner in this language and you seem all very helpful :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.