Problem compiling program


 
Thread Tools Search this Thread
Top Forums Programming Problem compiling program
# 15  
Old 05-21-2006
Quote:
/usr/ucb/cc
/cc
/cc/SUNWspro/bin/cc
/cc/SUNWspro/SC4.2/bin/cc
/cc/SUNWspro/SC4.2/include/cc

please help
So you're on Solaris. Please forget about /usr/ucb/cc, it's a BSD compiler and doesn't have "high tech" ANSI features like, ... the const keyword. Try /cc/SUNWspro/bin/cc. If you're on Solaris 10, you should also have /usr/sfw/bin/gcc.
# 16  
Old 05-22-2006
I get both a.out and hello2 when I compile hello2.c using gcc and cc.My problem is that when I want to run either a.out or hello2,I get the error:"bash: hello2: command not found"
I am in bash shell.
Thanks
# 17  
Old 05-23-2006
Quote:
Originally Posted by alphakg
... My problem is that when I want to run either a.out or hello2, I get the error:"bash: hello2: command not found"
yes, because the shell doesn't know where to find the executable and execute it. So, you just need to modify the above PATH environment variable.. add a . (which means current directory) add the beginning of your PATH env var:

export PATH=".:/usr/ucb:$PATH"

and rerun the .profile file (or .bashrc) with the command:

Code:
$ . .profile

now you should be able to execute your executable programs.. Before doing this you can try your exe by typing ./hello2 at command prompt and it should execute...
# 18  
Old 05-23-2006
I added the export statement to .bashrc and .bash_profile and saved it
then I executed . .bashrc command from command prompt
then I compiled using cc -o hello2 hello2.c and gcc -o hello2 hello2.c
but I cannot run ./hello2
# 19  
Old 05-23-2006
check if the binary that cc creates is executable

are u getting any cannot execute message ?
if so, change the perm bits of the executable
# 20  
Old 05-23-2006
I changed the permission for the executable but I still get

bash: ./hello2: Permission denied
when I run hello2
# 21  
Old 05-24-2006
Quote:
Originally Posted by alphakg
I changed the permission for the executable but I still get

bash: ./hello2: Permission denied
when I run hello2
alphakg, 2 questions:
1- what platorm are you using?
2- what's the output of "ls -l" command in your current directory where you are compiling your program? Post the output of the comand here..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Error compiling program with extension .c

good morning, I have 64-bit DB2 V9.7 AIX 7.1.0.0 I am compiling a C program, when running cc-I / rutadb2/include-c programa.c this error. ksh: cc: not found. how I can check if I have installed the C compiler? Any help will be greatly appreciated. Thank you very much and best regards. (2 Replies)
Discussion started by: systemoper
2 Replies

2. Programming

Compiling a 64 bits program using gcc

Hi Everyone, I can ask what is the option to compile a 64 bits program using gcc. I have looked everywhere but can't find it. Before I used to use cc and the -q64 flag was the option to generate the 64 bits binary. Can anyone tell me what is the flags when using gcc. Thanks...... (3 Replies)
Discussion started by: arizah
3 Replies

3. UNIX for Dummies Questions & Answers

Problem compiling 3rd party g++ program

I'm trying to compile a 3rd party program used for solid-state chemistry that calculates pore characteristics of an input material. The program was written between 2000 and 2006, so I believe the problem is that the headers used are outdated, but I'm not terribly computer savvy (and a complete... (1 Reply)
Discussion started by: motrax
1 Replies

4. Programming

compiling old C program in Linux.

Hello, I am writing to ask for support about compiling an very old but famous C-progam for genetics study called MapMaker/QTL, and the source code is available from MIT: http://www.broadinstitute.org/ftp/distribution/software/mapmaker3/The program was originally designed for systems like SunOS... (1 Reply)
Discussion started by: yifangt
1 Replies

5. Programming

compiling c program in unix

if somebody can help me pls. i need the source code for a shell which compiles C or java programs in unix i need a very short and simple one, just the compiling part Respect (2 Replies)
Discussion started by: zlatan005
2 Replies

6. Solaris

Compiling and Running C Program on Solaris

Hello Guys, I am using Solaris Developer Express Edition 9/07, I am a beginner. Please tell me how to compile and execute a C program. Please give me your answers clearly, for the compilers cc,c89,c99. please....... reply to me. I not getting the answer anywhere.. Advance... (2 Replies)
Discussion started by: selva_ss
2 Replies

7. Programming

help on compiling a C program on Tiger

here is the very simple bob.c: main() { printf("hello"); } i use tiger and i use the command: gcc bob.c and the end result: bob.c: In function ‘main': bob.c:3: warning: incompatible implicit declaration of built-in function /‘printf' any help appreciated, i'm just starting... (4 Replies)
Discussion started by: cleansing_flame
4 Replies

8. Programming

Compiling a C program

Help I know nothing about c programming. :confused: I want to compile the below c program. It extracts data from an oracle database into csv files. I have oracle 9206 installed with ProC. I dont have gcc My question is. How the hell do I make this into an file I can run? I am pulling... (3 Replies)
Discussion started by: ooploo
3 Replies

9. Programming

Compiling a program

Hello. I am trying to run a c program on a unix shell (ssh). I have searched this forum but have not come accross the soultion to my problem, so I am posting my question here :cool: I wrote the following simple code: #include <iostream.h> using namespace std; int main() { ... (7 Replies)
Discussion started by: Minnesota Red
7 Replies

10. Programming

Error Compiling C program

Hi All, I tried to compile a C program but i am getting error while Linking . it says Undefined reference to ' ' (here it gives a method name which is defined Globally ). Can any body tell the resaon and remedy for the same . Iam stuck up here . Thanks (3 Replies)
Discussion started by: Vivek
3 Replies
Login or Register to Ask a Question