C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-11-2009, 10:03 PM   #1
Registered User
 
Join Date: Sep 2009
Posts: 10
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.
el9335 is offline   Reply With Quote
Old 09-11-2009, 10:23 PM   #2
Registered User
 
Join Date: Oct 2008
Location: TX
Posts: 1,262
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
itCbitC is offline   Reply With Quote
Old 09-11-2009, 10:41 PM   #3
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,740
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.
tabstop is offline   Reply With Quote
Old 09-12-2009, 09:37 AM   #4
Registered User
 
Join Date: Sep 2009
Posts: 10
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
el9335 is offline   Reply With Quote
Reply

Tags
compile, gcc

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 11:22 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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