Compiling Problem in Unix using Pico

This is a discussion on Compiling Problem in Unix using Pico within the C Programming forums, part of the General Programming Boards category; Wondering if someone can help me with this, it is confusing the hell out of me, I don't have enough ...

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    16

    Question Compiling Problem in Unix using Pico

    Wondering if someone can help me with this, it is confusing the hell out of me, I don't have enough background to troubleshoot this particular problem. I'm not quite new to programming in C, but I'm no master (yet). I'm using putty for this class. lab1 and lab2 are programs with separate objectives.
    Any help would be appreciated. Thanks!
    Emily


    This is a part of an e-mail I sent to my professor..."~" is the main directory for my user account.


    I have written the code for a class lab, but have run into many problems compiling. In short:

    -this may have all started because i tried to look at my lab2 file using VI. in trying to exit with what i thought were the correct commands, i may have made changes to the code, but i couldn't see because there was a big mess of numbers and symbols.
    -tried to run the file from lab2 again, got "segmentation fault". okay, i say to myself, i'll deal with that later. oh yeah and when i opened w/ pico again it showed more symbols, numbers, etc.
    -create new directory while trying to familiarize myself with unix, called "thebox" (no longer in the system). started programming lab1 "temple" project from that directory. figured out that i can only compile from "~". mv file to "~" and try to compile again. no errors, but when i run "temple" i see it has become the lab2 program but what i compiled was the file that i edited for lab1"temple". rewrite the code again from scratch under "Temple" compiles with no error but it too has become the lab2 program. "temple.c"..same thing.

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,058
    What Unix variant are you using and on which platform? Provide a listing of your working directory and the path to your C compiler.
    Code:
    ls -latr
    whereis cc
    which cc

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Did you try to look at your executable with vi? Eep. Short piece of advice: don't ever look at an executable file with a text editor. Longer piece of advice: don't ever ever ever ever look at an executable file with a text editor.

    You should be able to compile from any directory; having said that, your source code has to be where you are to compile. If your "temple.c" is your lab2 program, most likely was that was you moved the lab2 file instead of the lab1 file, but it's not clear.

  4. #4
    Registered User
    Join Date
    Sep 2009
    Posts
    16
    Thank you for offering help. I figured out what the problem was, i was using an incorrect compiling command, I was creating an exe file with the lab1 name using lab2.c, so I was renaming the wrong prog over and over again. Good to know you're out there to help. Thanks!
    Emily

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with compiling code with option -O2
    By koushikyou in forum C Programming
    Replies: 16
    Last Post: 01-07-2009, 06:03 AM
  2. Datagram Unix socket problem
    By karas in forum C Programming
    Replies: 9
    Last Post: 07-27-2006, 11:08 AM
  3. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 02:09 AM
  4. UNIX File problem
    By DISGUISED in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 08-09-2002, 12:07 PM
  5. Problem with Borland 5.5 Compiling Windows Programs
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 08-28-2001, 10:04 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21