Results 1 to 6 of 6

Thread: Unable to compile and execute code

  1. #1
    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.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    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.

  3. #3
    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.

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    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.

  5. #5
    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.

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    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.

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,281,616.71249 seconds with 17 queries