I'm trying to start using code::blocks to do some C programming in just to learn. I was hoping to use the codecompletion / calltips feature (e.g. when typing say "printf" it popsup a handy dropdown box that shows the parameters.
I've made a new project and a new file in that project called "hello.c"
#include <stdio.h>
int main(){
int test=0;
printf("%d",test);
return 0;
}
but midway through typing prin---only "priority_queue and private" show up, no printf functions, and nothing happens when pressing ctrl-j, ctrl-space, alt-shift-space, ctrl-n or p nothing works. I've tried reparsing the project. I initially had 13.12 version installed because that's what Ubuntu (14.04.4LTS) had but then I installed version 16.01 by mucking with the apt-get ppas. That version also doesn't work. I've tried disabling and reenabling the code completion plugin and I've made sure under settings->editor-> that code completion box is checked.
What am I doing wrong here? Any help would be very appreciated. Thanks so much!
The new Code::Blocks IDE is not so polished on Ubuntu yet. You can try reinstalling it. And if it didn't work try reverting to 13.12.
Related
#include <stdio.h>
int main()
{
int a,b;
printf("Enter the value of a\n");
scanf("%d",&a);
printf("Enter the value of b\n");
scanf("%d",&b);
printf("The sum of a and b is %d", a + b);
return 0;
}
When i run this code in Microsoft Visual Code the code doesn't stop executing nor do i get the output. It starts running but it does not stop. I am also not getting any output. Other type of code is working perfectly fine.
Anyone can help me with this?
click here for image from vscode showing the running window
The code you have written is 100% correct.
Take care of the following things, check it out, if you have done them:
Install gcc in your system. gcc helps u compile c or c++ codes.
Install a C/C++ extension from the extensions section in the visual studio code.
At last, if the situation is still the same, try to re-install the visual studio code.
I hope, this might helps you. If you liked my suggestion, please press the upvoke button to motivate me to write such answers for you.
Thanks!
if this thing happens again first again try to execute the same code with some other IDE or run your code separately with CMD or PowerShell.
Code runner extension runs code in the output file which can not be interacted with. You have to change it so it runs in the terminal.
Go to the menu Code > Preferences > Settings.
In the User tab on the left panel, expand the Extensions section.
Find and select Run Code Configuration.
Find and check the box Run in Terminal.
I had exact same problem and it turns out I forgot to save the code:)
The main reason why code is not running is because it is running in "Output" Window, which I had shown in the linked Image.
If you want to run code properly then you have to run it in "Terminal" Window.
For running your code in "Terminal" window you have to follow these steps:
Step 1: Open Settings.
Step 2: Then type "Run in Terminal" in search box of the setting. Scroll below and find that setting.Install code runner if you haven't.
Step 3: Tick the box which is in 2nd line.
After that your code will run properly.
I installed VSC and wrote this program
#include <stdio.h>
int main( void )
{
printf("Hello world!");
}
Then I installed a C/C++ debugger and I saved the file on the desktop as "hello.c" and magically the syntax became higlighted.
Now I would like to run the program, but can't find a way.
There's no "run" or "build" option anywhere, and if I start the debugging and choose the debugger then I got a new tab named "settings.json" with a couple of brackets waiting for me to write something.
Also in the left I can read that I "have not yet opened a folder". What does it even mean?
And the line #include <stdio.h> is underlined in red, like there's something wrong going on, maybe I have to download the library?
I would do anything to see the output of the program, please help me.
have you added c/c++ and code runner extensions?
I'm beginner for C language and for Eclipse IDE. I've downloaded and installed Eclipse ide for c/c++ developers i.e. Mars 2.0. I've created a new project and selected the appropriate compiler and typed the following code:
#include <stdio.h>
int main()
{
printf("Hello, World! \n");
return 0;
}
After, when click build project it creates .exe file for me and when I click on Debug it successfully Debugs but shutdowns automatically within a fraction of a second.
From what you've told us, that would be correct. If you want to step through the code, you have to set a breakpoint. You should be able to double-click in the margin on the "printf" line to set a breakpoint there.
I am trying to compile Linux on cygwin, got tool chain which contains i686-pc-linux-gnu-* and
i686-pc-cygwin-, i thought i686-pc-linux-gnu- is for compiling linux, not sure with
i686-pc-cygwin-*. for me i686-pc-cygwin-gcc.exe is working fine, but
i686-pc-linux-gnu-gcc.exe is not working.
thanks in advance.
I am using Code::Blocks 13.12 for programming in C. After building and running my simple HelloWorld.c program, it gives an error.
Error: An alert box pop up saying -"cc1.exe has stopped working.A problem caused the program to stop working correctly.Windows will close the program and notify you if a solution is available."
I tried using Notepad++ , the same pop up appears saying a.exe has stopped working.
I am a naive,so have no idea on how to deal with this.
My queries:
1) Am I using an outdated version? If not, how can I get rid of this problem?
2) Which is the most efficient IDE available for C/C++ if Code::Blocks is not that efficient?
My requirement"
-I had been using Turbo C and it doesn't give errors like segmentation fault and other memory related errors that we get in online Compilers or compilers of competitive programming.So, I need an efficient compiler which behaves same as online compilers, so I don't get stuck while solving problems during competitive programming.
This is the simple code giving error:
#include <stdio.h>
void main()
{
printf("Hello world!");
//return 0;
}
Edit:
Even after changing the code to return int, it's giving an error.I tried editing the code as below, but the same window is being popped up again.
int main(void)
{
printf("Hello world!");
return 0;
}
There's no problem with your code, though indeed, as pointed out in the comments, neither void main() nor int main(void) is considered correct, but that's not what's causing the problem. cc1.exe is a MinGW-related file (MinGW is the GCC port for Windows that Code::Blocks uses by default for compilation); if it's crashing, it's possible the installation is corrupt.
I suggest you try reinstalling MinGW - remove Code::Blocks, install the standalone MinGW version, then download Code::Blocks without the compiler suite, install it and configure to use your version of MinGW.
For me, the solution was to choose,
Select target -> Release
from the Build menu. It took lots of time for me to find this!