Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-12-2009
Member
 
Join Date: Apr 2008
Posts: 264
Unable to compile and execute code

Hi
I have a concern with code blocks and I can not find anything anywhere. I can not compile a simple "hello world" by default when creating a new program and it does not run. The log tells me
Code:
Project: Console application
Compiler: GNU GCC Compiler (called directly)
Directory: / home / testusr / Programming /
-------------------------------------------------- ------------------------------
Switching to target: default
Linking console executable: / home / testusr / Programming / console
execvp (g + + -L/usr/lib-o, / home / testusr / Programming / console .objs / main.o) failed with error 2!
Process terminated with status 1 (0 minutes, 0 seconds)
Already I noticed that it uses the compiler "g + +" while a project is C and not C + + (though it is configured with "gcc" in compiler options for C projects). Thank you to all those who try to help.
Reply With Quote
  #2  
Old 24-12-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Unable to compile and execute code

Hi
I am also launching the program in Linux and as windowminator, I'm just like you. Yesterday evening I installed Code:: Blocks (latest release), I'm using Kubuntu, So I followed a tutorial from their official site.
I think that you need this to type in your terminal
Code:
sudo apt-get install build-essential
I can not guarantee that this will resolve your problem but try this.
Reply With Quote
  #3  
Old 24-12-2009
Member
 
Join Date: Apr 2008
Posts: 264
Re: Unable to compile and execute code

Hi
Ah yes I forgot to mention that I was under mandriva!
So, I tried to install build-essential but no packages are named like that could you tell me what reposits it is possible in? Any more advice on this.
Reply With Quote
  #4  
Old 24-12-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Unable to compile and execute code

Hi
To compile under linux, the simplest level facility is gcc. By cons he used the command line. Example for a source file named test.c, say they want to appoint an executable application:
Code:
gcc-o application test.c
Hope this will help you.
Reply With Quote
  #5  
Old 24-12-2009
Member
 
Join Date: Apr 2008
Posts: 264
Re: Unable to compile and execute code

Hey
With the gcc I could not build anything in console! But with your help I have managed it. In fact the hello world I started running in console. But actually I found in my / home / testusr a file named "Code:: Blocks testusr" and when I clicked it opens me with kwrite and it told me that the file is corrupted. This file has been generated by code blocks when compiling but why is it corrupted? Any ideas about this.
Reply With Quote
  #6  
Old 24-12-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Unable to compile and execute code

Hi
To run your script by double clicking, you need it create a launcher, and also that the script is located in a folder as part of PATH. For it is part of PATH, two possibilities, either you copy a folder already belong or you can add, for example your home directory to the PATH.
For that, you can type this in the console as normal user:
Code:
echo "export PATH = $ PATH: $ HOME"
From there, you can execute all scripts present in this folder by typing in console simply their name, without having to make the road ahead.
Now for the launch by DoubleClick, for kde (the others I do not know but it should look like) must create a launcher. You do a right click on desktop and you choose to create a new link to an application. In the application tab, command field, you put the name of the script and once validated, you have a launcher for your executable. For code block I do not know so I can not help it.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Unable to compile and execute code"
Thread Thread Starter Forum Replies Last Post
Can I compile code on AMD Opteron and run on AMD Xeon? Ga.One Motherboard Processor & RAM 5 11-12-2011 12:02 PM
Unable to compile managed C++ code by using the VC 7.0 fanish-war Software Development 4 25-06-2011 09:46 PM
How to get vlc source code and compile in windows xp Bhukkam Windows Software 2 24-04-2011 12:13 AM
Compile and execute a program in java ISAIAH Software Development 5 03-03-2010 01:07 PM
Getting an ERROR when trying to compile the Correct Code!? Beter 2 Burn Out Software Development 5 02-01-2010 08:30 PM


All times are GMT +5.5. The time now is 07:45 AM.