Running a program (written in C) in Linux [closed] - c

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm using Ubuntu.
I wrote a program in C which interacts with a Mysql Database
The compilation process goes smoothly (excepts several warnings) and I get the executable.
How do I run it in Ubuntu?
I mean, I use this command :
gcc -o magazzino main_magazzino.c -L/usr/include/mysql -lmysqlclient
How do I run magazzino?

if it is in the current directory, run ./magazzino

Usually:
./magazzino
The dot and slash are to tell the shell that you mean the executable in this current directory - otherwise it would search for the program in its $PATH and probably not find it. (Although it's possible to have the current directory in your PATH, this is a bad idea and not recommended for security reasons.)

Just use
/path/to/magazzino
And if your current_folder is same with where magazzino stored use
./magazzino

In the directory type in,
./magazzino

Related

Where is executable file after compiling a c program in ubuntu? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 3 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
While compiling a C file in windows I get three files a .c file a .o file and a .exe file, now if i want to distribute my program I will give .exe file. But after compiling a .c in ubuntu I can't find the executable file which will run directly on other system by just clicking it.
The default file name is a.out, but you can specify another filename with gcc a.c -o my_executable.

How to compile a C programm using cmd? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have installed Dev C++. Now I want to run my C code from Command window in windows 8.1 . I have added path of bin folder in dev c++ to environment variables. But still I am not able to compile my programm.
Any suggestion on how to compile it using cmd will be much appreciated.
Unfortunately, what you've tried to do wouldn't work since Dev C++ is an integrated development environment and it has its own compiler (MinGW), besides, you only need a compiler so your best bet is to offer a look at this topic : Compiling C++ in cmd using MinGW on Windows 8
Side note : most basics are covered in almost every forum, so if you find yourself blocked don't hesitate to google it up or look for the question in this website itself

Execution of C in linux [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am programming in NDK for android and it got me thinking. I know C is platform independent language but compiler dependent. With that in mind how does the execution of a C program vary from Windows->Linux->Mac. I mean the source code produces .obj file and .exe file in windows. But how about Linux or Mac? What type of file extension does it follow in Linux and Mac. If someone could elaborate on this, I would be very happy.
On linux and MacOs (Unix System) the files have the extension .c and to execute this you should compile them with
gcc -o myprog myprog.c
after it a binary file .o will be product and after you can run it with the file : myprog
by using this line of command :
./myprog
see how linux work if you are interesting by this you can read about Linux things like POSIX
I hope I have explain you the best way. (sorry i'm french :( )

Unable to compile a c program in Codeblocks? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have installed codeblocks in windows 8 first time and try to run a simple C program but I get this error?
"can't find compiler executable in your search path (GNU GCC compiler)"
I tried many things to solve it but unable to compile.
I kind of encountered this problems long before.. when I was still using Windows and the Air-Quality in Beijing was still good at that time.
A problem code-blocks have, is that it might not find the proper C code compiler for you automatically. One think you can do.. is to go to the options(or something like that), and look for the compiler option, and it have some settings for you to set the compiler.
If you cannot find a proper compiler, I usually go install wxDev and use the wxDev's gcc in Code::Blocks.
Hope that helps :)

How to write into portable executable (PE) file while running? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
The problem is that I've a Windows executable (.exe) file, and I want its process to modify some values inside its image file while running, so the next time the program can continue execution from the point it stopped, what is the best way to do that?
Your application can use a file to store configuration and execution data. Open the file on program start to get initial values and modify the values in the file as they are modified in the program. This is certainly better than trying to modify the executable, if it's even possible.

Resources