1

I have problems related to C programming on Ubuntu 12.04. While compiling C program consisting pow I faced difficulties. Then I searched the Internet and got the solution with -lm. But that's the compiling part. How to execute and Run that program that has pow in it? I failed to execute and run. The message said No such file or directory. What can I do?

Again, is there any easy way of learning C programming on Ubuntu, where I can fully concentrate on coding? I prefer not to have to think about compiling, executing and running the code. Should I use an IDE for that? What do you say?

2 Answers 2

1

The problem using the function pow is that it's a function from another library, not from the C language. So, you need to link to the math library. But I don't get why you can't run the program. What complete command are you using to compile and what to run?

About using an IDE, I recommend you not to use it while you're learning, or you can miss the understanding of how everything works.

2
  • "gcc -Wall 13.c -o 13.out -lm" "chmod +x 13" "./13" These are the codes I used for compiling, executing and running my code. It compiled I think, but failed to execute and run. The message says 'No such file or directory'.
    – user86131
    Oct 11, 2012 at 5:26
  • 3
    You should do "chmod +x 13.out", no? and execute "./13.out" Oct 11, 2012 at 5:28
0

As you are about to use the math.h header file. In terminal:

cd /your/directory/name
cc your_program.c -lm

I think this helps you.

You must log in to answer this question.