Compiling C program in NetBeans 7 - c

I have a problem with netbeans 7 about debugging and running C program, the problem is that after I wrote the code as the following
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("done");
"khaled";
return 0;
}
in the output panel everything goes well but there's not any real output project (excutable file) no window appears.
I use gcc complier as the C compiler.

Related

Why does my code keep failing in codeblocks?

Here's the code I wrote.
#include <stdlib.h>
#include <stdio.h>
int main(void){
printf("hello World.");
return 0;
}
This is the error message
Execution of '"C:\Users\Happy Birthday\Desktop\Coding\C++\C_C++ project\simple program.exe"' in 'C:\Users\Happy Birthday\Desktop\Coding\C++\C_C++ project' failed.|
I figured it out. I had to go to the location of the bin for MinGW, copy and paste its address into the Toolchain executables tab of the global compiler settings, as opposed to auto detecting it.

Print statement not working on CodeBlocks for Mac

I've recently downlaoded code blocks for mac and for some reason my code compiles with no errors but when I try to run it in terminal to see if it prints it doesn't print anything. This is my code. I have already downloaded x code and my program is able to build in code blocks but print f will not work. Can someone please give a solution to this problem.
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello world!\n");
return 0;
}

"Hello world" program not running

I typed this program on code blocks but it is showing error on int main line
Here's the program
#include <stdio.h>
int main()
{
printf("Hello");
return 0;
}
The message return is " multiple definition of main"
The sample code is correct. It might be an IDE configuration error. Use gcc to compile your code on Linux and on Windows you can install MinGW and execute from a command window.

Simple C code prints nothing to terminal

I ran a 4 line code and it compiled and linked without a hitch, but it refuses to print anything
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char* a = "book";
printf("%s\n", a);
return 0;
}
After compiling it and running the executable, nothing happens.
No error in the code.
Just write getch(); or getchar() before return 0;
to holding the output screen.
getch() or getchar() will hold the ouput screen for getting the user's input.
Works fine for me.
You've tagged this with terminal; if you are running it from the terminal, you should see some output, in my experience.
If you are running from an IDE,
keep the window open using Kapil K.'s answer;
keep the window open using an IDE setting, if there is one; or
find out where your IDE is putting the executable file, and run that from a terminal.

Allegro error in DevC++

I am running the latest DevC++ 5.5.3 and I need to use the Allegro 5.0.4 so I downloaded it from devpaks and install it common way. But when I want to run the project with allegro the compiler show me error "allegro.h: No such file or directory". I was looking for the answer but I haven't found the relevant one. And what more I have to use DevC++.
#include <stdio.h>
#include <allegro.h>
int main(void)
{
allegro_init();
allegro_message("Hello World");
return 0;
}
END_OF_MAIN()
Linker is set to -lalleg
Allegro 5 is not backward compatible with Allegro 4. It is a brand new library made by the same people.
Your code snippet is for Allegro 4.
The equivalent is:
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
int main(void)
{
al_init();
// al_init_native_dialog_addon(); // Introduced in 5.0.9
al_show_native_message_box( /* fill in params */ );
return 0;
}
You would need to link against the main Allegro library along with the native dialogs library.

Resources