eclipse: C - Console Window Input - c

In eclipse, how do I tell the console to submit the text? When I press enter, it just goes to a new line where I can continue typing and does not submit the text to continue processing.

To heck with eclipse.. I found a way of getting Visual Studio to compile C++ projects as C projects.. much better... after spending so many hours trying to get the IDE working with all its quirks... I don't think I'll be going back to that again (at least not for anything C anyway).
For anyone interested:
http://www.daniweb.com/software-development/cpp/threads/16256/compiling-c-in-visual-studio.net
Basically:
Go to project properties
Go to C/C++ node
Select "Advanced" subnode
Go to property "Compile As" and select option "Compile as C Code (/TC)"
Click OK and go back to solution explorer..
Change file extensions from .cpp to .c
That's it..

Related

.exe files dissapear when they want in VS code

Things that i should note are that I am using the latest version of vs code to write in c, my compiler is mingw-w64. Whenever I run a simple code (Hello world for example) everything works then suddendly when I try to do something else a message appears saying (program name).exe was not found. This generally happens when I try to use commands from other libraries, i tries using conio.h textcolor() but it doesn't want to, but when i use getch() it works fine. Moreover the .exe file exists, then i add a single line of code and boom suddendly it doesn't exist. Can anyone explain to me what is going on??

First steps in Eclipse

I try to figure out Eclipse by writting a HelloWorld.c from scratch and hope that you can give me some help concerning the problems I face.
When launching Eclipse, I select the standard workspace.
In the Project Explorer, I create a new C project, called HelloWorld. Settings are "Empty Project" and "MinGW". Next: Debug and Release activated. Finish.
In the Menu toolbar "Window->Preferences", I make sure that under "General->Workspace" the "Text File Encoding" is set to UTF-8 and "New Text File Line Delimiter" to Unix. Apply and OK. Again under "Window->Preferences->C/C++->New C/C++ Project Wizard", under "Toolchains" I select "MinGW GCC". "Make Toolchain(s) preferred", "Apply", and "OK".
Now all the necessary setings for this C project are saved in a settings file in the project folder - if I understand this right.
In the Project Explorer, ther HelloWorld Project contains now a header-folder with three subfolders (C:/MinGW64/lib/gcc/x86_64-w64-mingw32/someversion/include and .../include-fixed, and C:/MinGW64/x86_64-w64-mingw32/include).
I create a new C Source File with explicit name "HelloWorld.c" and I get a nice window with lines to write any desired code and also an outcommented "HelloWorld.c"-title on top.
So I write
#include <stdio.h>
main(){
printf("Hello World!");
return 0;
}
and save it. So far, so good.
Now, I press "Build All" and get a Warning "return type defaults to 'int' [-Wreturn-type]".
When I press "Debug", I get the message "Info:Nothing to build for HelloWorld" but when I press "Run", the Console shows "Hello World!" anyway.
In previous (very same) projects, I already got error messages like "Launch failed. Binary not found." which disappeard after many times pressing "Build All" and "Run". And also the error message "Program file does not exist." although I just wrote and saved the above C Source File code. I could not solve it, deleted the Project, restarted Eclipse and did all again as explained above.
What did I or am I doing wrong?

Installing codeBlock

This is my first time of trying to develop with C programming language. I tried installing codeblock on my window 8 operating system, but whenever I run the codeblock program I get this error in the image below
I installed codeblock hopping that it would install the compiler alongside, but I was disappointed. I do not know how to install the standalone compiler, I checked it up online, but I really do not know from where to start, and I do not know if the problem is with my system. I would appreciate help on how to make my codeblock work properly or any other suggestions. Thanks all.
When running CB for the first time, you are prompted with a "Compiler auto-detection" dialog/window.
It looks like you chose the WRONG COMPILER -> GCC for MSP430 micro controller!
Correct that to GCC/MinGW
EDIT - 1: Its usually the first option on the "Compiler auto-detection" dialog
EDIT - 2
I think you may also have selected the wrong compiler for your CB project
For C project, Follow these steps:-
Create a new project -> Console application for C/C++,
Skip the first page, click next
Provide a title & path, click next
at compiler selection screen, select "GNU GCC Compiler" instead of "GNU GCC Compiler for MSP430"
The compiler might not be included in the Code::Blocks you downloaded (if you got codeblocks-12.11-setup.exe). There's another downloadable binary (codeblocks-12.11mingw-setup.exe) that includes the MinGW environment with the GNU GCC compiler. You might want to try that one.
Step-1 : Visit www.mingw.org/
Step-2 : Download and install all package.(Specially mark the the file starting from mingw)
Step-3 : Goto to installation and Apply Changes.
Step-4 : Now open your code block
Step-5 : Goto to Setting->Compiler
Step-6 : Now click toolchain executable AND SELECT GNU GCC COMPILER
Step-7: Click autodetect and then OK
I hope this will definitely work out, All the best
Just goto setting > compiler and click on "restore default" . Then yes and ok .Done . I think it will never occur the error.

Compiling real mode asm (rootkit.arsenal)

Im stuck on compiling the tsr.asm code provided in the book rootkit arsenal.
I installed open watcom on a XP maschine and the first asm listing was compiled well.
When compiling, it throws the error: "multiple starting address found" (nothing found on google). Can anyone confirm that this code is compilable, and how?
Im thankful for any suggestions.
When you're writing some code, there is a particular address where the execution is to begin (the main function in C for example), but in your code there are more than one starting address, and it crashes when compiling. But without seeing the code I can't tell you more.
Sorry for the late answer, but I was searching for an answer to this and just figured it out - hopefully it'll help someone else Googling around for an answer.
Since you're using OpenWatcom (I'm using version 1.9), I'll assume that you have tsr.asm in its own OpenWatcom 16-bit DOS COM project. In the IDE, go to Targets -> Target Options -> Linker Switches. In the window that appears, select "2. Import, Export and Library Switches" from the drop-down at the top and remove the cstart_t entry under "Library files(,): [libf]".
Recompile, and your TSR COM file should be generated.

CodeBlocks MinGW on XP noob. Is it possible to overwrite the same exe every time I compile? Further explanation inside

I have looked through both the CodeBlocks and MinGW FAQ and wiki to no avail. As stated above I am a noob.
I want CodeBlocks to act like a Unix compiler in that it overwrites a single output file every time it compiles unless told to do otherwise.
In Unix:
[cc example.c] -> [a.out], [cc example2.c] -> [a.out]. If I want to save the output file from being overwritten i just [cc -o newname example3.c] - [newname.out].
If this is possible with CodeBlocks/MinGW on XP I'd like to know how to do it. If not I would appreciate recommendations for another GUI compiler/IDE that could. Any help is appreciated. Thank you.
I want CodeBlocks to act like a Unix
compiler in that it overwrites..
First of all, C::B isn't a compiler -- it's an IDE. Saying you want C::B to act like a compiler makes no more sense then saying you want vim, emacs, or visual studio to 'act' like a compiler.
Second, you change the name of the final executable by right-clicking a project in your workspace. Goto properties->Build targets tab->select which build target you want to change. On the right side of this you'll see Output filename. Enter the executable filename the linker should output here. Alternatively, you can just navigate to the location of your existing executable and just rename it to something else.
And thirdly, chances are you're not even going to be checking back on this site so I'm probably just wasting my time giving an answer to your post.

Resources