LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-09-2010, 03:05 PM   #1
mothergoose729
Member
 
Registered: Aug 2008
Distribution: Ubuntu x64
Posts: 118

Rep: Reputation: 19
Having trouble using codeblocks IDE. Quick run through?


I just recently switched over my main machine to full time linux. One of the things I liked from windows was bloodsheds C++ IDE, I have been trying to get used to codeblocks for Kubuntu instead, but I haven't all figured it out. I just simply want to want to create a simple "hello world" app that I can compile and run from the IDE, so then I can start working on assignments for my intro to structure programming class. Help getting that far would be great, thanks .
 
Old 04-09-2010, 03:07 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by mothergoose729 View Post
I just recently switched over my main machine to full time linux. One of the things I liked from windows was bloodsheds C++ IDE, I have been trying to get used to codeblocks for Kubuntu instead, but I haven't all figured it out. I just simply want to want to create a simple "hello world" app that I can compile and run from the IDE, so then I can start working on assignments for my intro to structure programming class. Help getting that far would be great, thanks .
Why do you need an IDE ?

I.e. why can't you for starters use plain gcc/g++ ?
 
Old 04-09-2010, 03:16 PM   #3
mothergoose729
Member
 
Registered: Aug 2008
Distribution: Ubuntu x64
Posts: 118

Original Poster
Rep: Reputation: 19
IDEs make my life much easier. Without one I will probably just continue to program in windows.
 
Old 04-10-2010, 12:21 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by mothergoose729 View Post
IDEs make my life much easier. Without one I will probably just continue to program in windows.
So, how are you going to debug a real time program or an OS kernel ?
 
0 members found this post helpful.
Old 04-10-2010, 06:53 AM   #5
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I'm using CodeBlocks a little in both Linux and Windows. In Linux I did have some initial problems because practical use of CodeBlocks depends on some other packages that are not identified as dependencies, so Synaptic (the package manager I use) did not install them.

Unfortunately I didn't record the details anywhere.

CodeBlocks UI is fairly obvious, so I think it is not so likely that you don't understand how to use it and more likely that you haven't installed some of the other software packages you need in order to use it.

If you are trying something that looks like it ought to work but doesn't, it probably should. Describe what you did and what went wrong and hopefully someone can guess what software is missing.

If you know what is missing, then it is trivial in Synaptic to install it.

Obviously you need to install the compiler and associated headers and libraries for software development in C++. CodeBlocks installation rightly does not assume your chosen language is C++.

Ubuntu has a package called build-essential that brings in several of the most important packages needed for building other software. So make sure you have that installed before even asking what else might be missing.

There are also basic tools for auto generating makefiles that I think CodeBlocks always needs but that also are not installed automatically when you install CodeBlocks.

Quote:
Originally Posted by Sergei Steshenko View Post
Why do you need an IDE ?

I.e. why can't you for starters use plain gcc/g++ ?
Quote:
Originally Posted by Sergei Steshenko View Post
So, how are you going to debug a real time program or an OS kernel ?
I expect you've noticed in other threads that I don't believe in routinely answering the question the OP asked. If I am fairly sure the OP is going down the wrong path and should be doing something different and or asking a different question to address his real problem, I'm always in favor of a useful reply (which is often a question back at the OP) rather than a direct answer to the literal question.

So if you really believe an IDE isn't a valid path for the OP, your replies could have constructive intent. But even if you and many others never want to use an IDE, it is very hard to argue that it isn't a valid choice for those who want to.

I expect the OP would appreciate cutting off the discussion here about whether to use an IDE and continuing this thread only on how to use an IDE.

Last edited by johnsfine; 04-10-2010 at 07:16 AM.
 
1 members found this post helpful.
Old 04-10-2010, 02:30 PM   #6
mothergoose729
Member
 
Registered: Aug 2008
Distribution: Ubuntu x64
Posts: 118

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by johnsfine View Post
I'm using CodeBlocks a little in both Linux and Windows. In Linux I did have some initial problems because practical use of CodeBlocks depends on some other packages that are not identified as dependencies, so Synaptic (the package manager I use) did not install them.

Unfortunately I didn't record the details anywhere.

CodeBlocks UI is fairly obvious, so I think it is not so likely that you don't understand how to use it and more likely that you haven't installed some of the other software packages you need in order to use it.

If you are trying something that looks like it ought to work but doesn't, it probably should. Describe what you did and what went wrong and hopefully someone can guess what software is missing.

If you know what is missing, then it is trivial in Synaptic to install it.

Obviously you need to install the compiler and associated headers and libraries for software development in C++. CodeBlocks installation rightly does not assume your chosen language is C++.

Ubuntu has a package called build-essential that brings in several of the most important packages needed for building other software. So make sure you have that installed before even asking what else might be missing.

There are also basic tools for auto generating makefiles that I think CodeBlocks always needs but that also are not installed automatically when you install CodeBlocks.





I expect you've noticed in other threads that I don't believe in routinely answering the question the OP asked. If I am fairly sure the OP is going down the wrong path and should be doing something different and or asking a different question to address his real problem, I'm always in favor of a useful reply (which is often a question back at the OP) rather than a direct answer to the literal question.

So if you really believe an IDE isn't a valid path for the OP, your replies could have constructive intent. But even if you and many others never want to use an IDE, it is very hard to argue that it isn't a valid choice for those who want to.

I expect the OP would appreciate cutting off the discussion here about whether to use an IDE and continuing this thread only on how to use an IDE.

Thank you, your reply is much appreciated. My needs are really pretty simple, I just want to create console applications, compile, and run them. I need to be able to link with .obj files, and I need the compiler to be able to direct me to the line of code that an error exists. I am not doing anything OS specific, just C++, so I really only need functionality.

I try and start a new console projects, using only the namspace std and iomanip class, and when I hit the button to compile and run nothing seems to happen.

Last edited by mothergoose729; 04-10-2010 at 02:31 PM.
 
Old 04-10-2010, 03:22 PM   #7
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by mothergoose729 View Post
I need to be able to link with .obj files
Linux uses .o files for the same purpose that Windows uses .obj files. The format is different, so you can't use Windows .obj files when building a Linux program.

Quote:
I try and start a new console projects, using only the namspace std and iomanip class
When I start a new console app in CodeBlocks, selecting C++, it creates main.cpp for me containing the usual Hello world program. There is a Projects tab on the left, where I can open the Sources subtree then click on (opening) main.cpp and see the Hellow world program it created. Does that much work for you?

Quote:
when I hit the button to compile and run nothing seems to happen.
Did you install that build-essential package I mentioned above?

I also have autoconf and automake installed in my system. I got a failure similar to what you describe while testing some IDE quite a while ago and got past it be installing those two packages and a few other (probably it only needed automake). I don't think that IDE was CodeBlocks, but it might have been.

Also, in synaptic find and click on codeblocks, then click on the Dependencies tab, and look at the items that say Suggests or Recommends. Those are other packages needed for various features of CodeBlocks. You ought to look at the description of each of those in Synaptic to see whether you want to install it.

Last edited by johnsfine; 04-10-2010 at 03:47 PM.
 
Old 04-11-2010, 03:14 AM   #8
mothergoose729
Member
 
Registered: Aug 2008
Distribution: Ubuntu x64
Posts: 118

Original Poster
Rep: Reputation: 19
Thanks, I am going to play with it a bit more and post back if I have problems. Is there a way to convert .obj files to .o, or might it be possible to run them or another IDE with WINE?
 
Old 04-11-2010, 04:15 AM   #9
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by mothergoose729 View Post
...
Is there a way to convert .obj files to .o
...
There is set of tools under UNIXes called 'binutils', so formally you can convert one object format into another.

But there are "deeper" problems:
  1. maybe different calling conventions;
  2. call to Windows-specific functions.
 
Old 04-11-2010, 09:49 AM   #10
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by mothergoose729 View Post
Is there a way to convert .obj files to .o, or might it be possible to run them or another IDE with WINE?
What are those .obj file and why do you need to use them (rather than source code)?

Also, are you using 32 bit or 64 bit kubuntu? And are those 32 bit or 64 bit Windows .obj files?

I expect you could install a 32 bit Windows CodeBlocks plus Mingw into 32 or 64 bit kubuntu within wine and develop and test 32 bit Windows programs in kubuntu. I don't think it would be easy. But I don't think there would be any really serious problem.

I don't know the level of support for 64 bit Windows, so I don't know whether 64 bit Windows programming in Windows codeblocks in wine would be flat out impossible or merely harder to set up than 32 bit.

I don't have much VM experience, but if you want to work on Windows programs in an IDE in Linux, you'll see a lot more people ahead of you able to guide the way if you use a VM rather than wine.

For the alternate approach, I'm not sure any conversion of .obj to .o to link Windows .obj files into Linux programs would be practical. But there as well, I do understand several reasons why however hard it might be in 32 bit, it would be even harder in 64 bit.
 
Old 04-12-2010, 02:23 AM   #11
mothergoose729
Member
 
Registered: Aug 2008
Distribution: Ubuntu x64
Posts: 118

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by johnsfine View Post
What are those .obj file and why do you need to use them (rather than source code)?

Also, are you using 32 bit or 64 bit kubuntu? And are those 32 bit or 64 bit Windows .obj files?

I expect you could install a 32 bit Windows CodeBlocks plus Mingw into 32 or 64 bit kubuntu within wine and develop and test 32 bit Windows programs in kubuntu. I don't think it would be easy. But I don't think there would be any really serious problem.

I don't know the level of support for 64 bit Windows, so I don't know whether 64 bit Windows programming in Windows codeblocks in wine would be flat out impossible or merely harder to set up than 32 bit.

I don't have much VM experience, but if you want to work on Windows programs in an IDE in Linux, you'll see a lot more people ahead of you able to guide the way if you use a VM rather than wine.

For the alternate approach, I'm not sure any conversion of .obj to .o to link Windows .obj files into Linux programs would be practical. But there as well, I do understand several reasons why however hard it might be in 32 bit, it would be even harder in 64 bit.
These .obj files are used by my professor to seed and check the functions we right. We have been using devshed C++ and using the linker options to run them in place of a main file. This lets him keep the contents secret and test our programs. It won't be possible to do my homework in the class without the ability to run them. AFAIK none of them are OS specific. Some of the require reading .txt files, but that can be easily emulated with wine so I am not worried.

Might the simplest thing to do be to install devshed IDE and then use my programs with wine directories?
 
Old 04-12-2010, 04:33 AM   #12
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
you could try Qt.
that has a fabulous IDE which works on all platforms.
 
1 members found this post helpful.
Old 05-20-2010, 11:36 PM   #13
mothergoose729
Member
 
Registered: Aug 2008
Distribution: Ubuntu x64
Posts: 118

Original Poster
Rep: Reputation: 19
BUMP

I had to take a lot of time off for other things, but I recently got back into trying to get codeblocks working. I am now able to build and compile projects within code blocks using the GNC compiler. When I try and run them though i get this error from the console:
Code:
sh: home/me/C++projects/test/untitled2: Permission denied

press ENTER to continue..
 
Old 05-21-2010, 02:30 AM   #14
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by mothergoose729 View Post
BUMP

I had to take a lot of time off for other things, but I recently got back into trying to get codeblocks working. I am now able to build and compile projects within code blocks using the GNC compiler. When I try and run them though i get this error from the console:
Code:
sh: home/me/C++projects/test/untitled2: Permission denied

press ENTER to continue..

Do you have a file called

home/me/C++projects/test/untitled2

?

And what does

Code:
ls -lt home/me/C++projects/test/untitled2
show ?
 
Old 05-22-2010, 02:44 AM   #15
mothergoose729
Member
 
Registered: Aug 2008
Distribution: Ubuntu x64
Posts: 118

Original Poster
Rep: Reputation: 19
Code:
me@LinuxPC:~$ cd '/home/me/C++ projects/test'
me@LinuxPC:~/C++ projects/test$ ls -lt
total 16
-rw-r--r-- 1 me me   84 2010-05-19 14:52 Untitled2
-rw-r--r-- 1 me me  240 2010-05-19 14:49 test.layout
-rw-r--r-- 1 me me   92 2010-05-19 14:48 Untitled1
-rw-r--r-- 1 me me 1033 2010-05-19 14:47 test.cbp
I am not an expert on shell prompt, but don't the rw and r flags mean read and write?

I tried this:

Code:
me@LinuxPC:~/mprime2511-linux64$ chmod u+x '/home/me/C++ projects/test/Untitled2'
Then when I tried to build and run it gave me this error:

home/me/C++/ projects/test/Untitled2: 3 syntax error: ")" unexpected.

Given this code:

Code:
#include <iostream>

int main(){
cout << "hellow world!";

cin.get();

return 0;

}
I don't see how that is possible.

http://i303.photobucket.com/albums/n...whatIwant1.png

Last edited by mothergoose729; 05-22-2010 at 02:52 AM.
 
  


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
codeblocks doesnt run after installing updates calicratis19 Programming 2 12-08-2009 09:40 AM
quick and silly question about eric IDE nephish Linux - Software 0 01-13-2006 08:39 AM
quick questions: IDE vs SATA toaster.waffle General 37 07-07-2005 12:02 PM
Virtual PC IDE Trouble zelmak Linux - Hardware 3 11-18-2003 03:48 PM
quick question about ide driver ocularbob Linux - Hardware 3 08-24-2003 11:58 AM

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

All times are GMT -5. The time now is 12:09 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