Greetings all. Ok, here is my story. I have slight background programming expierience. However, I am new to the need to have a compiler/debugger/IDE. IT is all a bit of a mess for me. I don't know much in terms of anything right now, but I am currently learning C++. Meaning, I need, at least, to be able to test run (debug) programs. I have no clue on how to compile them either, but I assume it'd be the same problem. I'd be glad to know the ins and outs of using it, but right now I just want to learn and get it to work. Right now, it seems a bit more than I need. All I really want is debugging, compiling... color-coding is useful however. Thus, I found my way to an IDE.
Long story short, I installed everything - basic stuff, othe rplugins, MinGW, etc. When I try to debug (start), it says... it isn't set. Go to toolchain exutables, etc. I did. I couldn't ifnd, however, which debug program you are supposedf to link to, or decompiler. Which makes it kind of useless currently.
Can anyone help me get started with this? It is a bit frustrating currently.
Thanks.
What is the name and version of your Compiler?
Tim S.
Thanks for replying.
As per compiler, none, really. I installed code blocks and the Min GW compilers and that stuff, if it helps. Not that I k now much about that, though.
I think you should start by reading up on your terms:
- What is Code::Blocks? (http://wiki.codeblocks.org/index.php?title=FAQ-General)
- Compiler (http://en.wikipedia.org/wiki/Compiler)
- Linker (http://en.wikipedia.org/wiki/Linker_%28computing%29)
Then read the relevant parts of Installing a supported compiler (http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler) (pay special attention to Compiler-neutral setup steps (http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler#Compiler-neutral_setup_steps)).
And finally:
- Creating a new project (http://wiki.codeblocks.org/index.php?title=Creating_a_new_project)
- Debugging with Code::Blocks (http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks)
If you are still unable to get it to work, post another question here (hopefully the above reading will enable you to find more specifications).
I read up on all of those articles, actually. Except on linking. I wasn't sure if linking or decompiling were part of debugging... for instance, MinGW has the debug program gdb.exe. I was a bit confused on the matter...
When I do auto detect, it switches to:
C:\Program Files\Microsoft Visual Studio 8\VC
Which is interesting... I tried to install visual studio but it failed. Unless, that is the installer. Either way. Hm.
Currently, The code blocks folder (and thus, MinGW within) are located directly on c:\
c:\Code Blocks, etc.
That is about all I know, currently. If I make a new project, edit the main.cpp, and trydebug > start, I get:
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\Programming\y\
Adding source dir: C:\Programming\y\
Adding file: bin\Debug\y.exe
Starting debugger:
failed
also, win a single file (not a project), there is no color coding , and in the debug start is grayed out. I am not very used to using multiple files for one .exe, (though I am sure I will learn that soon), and this is wh y the term of projects and th elike are a bit confusing for me. Is this significant?
PS: While I was making a new project to debug and get the above, C:B crashed. Mabye I am cursedd...
Quote from: chessguy on January 10, 2012, 01:20:39 AM
When I do auto detect, it switches to:
C:\Program Files\Microsoft Visual Studio 8\VC
[...]
Currently, The code blocks folder (and thus, MinGW within) are located directly on c:\
Go to
Settings->Compiler and debugger... and select "GNU GCC Compiler" from the drop-down menu at the top.
Now use auto detect.
Ah... that did something. I had had it on that, but it was when I typed it (looked the same, though) because it always seemed to revert back. Now, when I debug, it actually tells me if and where I did something wrong, very useful. However... and, for learning purposes, I am working on consoles.
I know that, when they are done exuciting, it will close. However, I want to see the program output. I added a part ot it which would, in theory, make it wait for the input of the user using cin, but it just opens and closes still. Like this:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
int x;
cin >> x;
cout << x << endl;
}
I realize that is more of a code thing, but in the debugger I used before, this would make it wait, so I am wondering...
Also, - I haven't compiled anything yet... it no longer gives errors when I do it, but trying "build", "run", build AND run, etc, don't seem to have effect. Bit confused. I should probbably read up on that article a bit more now that it has a chance of working, though.
THanks.
Yes, pausing to see what happened is nice :).
The problem with your method is that your program exits as soon as it reaches return 0; (it never reaches your other statements).
I normally pause with:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
cout << "Press enter to close program"; //Let the user know the program is done.
cin.sync(); //Clear the buffer (just in case).
cin.get(); //Wait for the enter key.
return 0; //Exit the program.
}
Locking topic now,.
We are not a "Teaching C++" forum. Try a more appropriate forums for such questions, please understand.