Hello. I am trying to compile, build and run some codes, but they just won't run. It can't be from a wrong code, because I even tried the main.cpp. Nothing worked. What should I do?
Hello. I am trying to compile, build and run some codes, but they just won't run. It can't be from a wrong code, because I even tried the main.cpp. Nothing worked. What should I do?
FAQ - CodeBlocks
Did you try turning "full Compiler logging" the directions in the link above?
Edit: If you have enable "full Compiler logging" what did Code::Blocks output?
Tim S.
Last edited by stahta01; 09-04-2011 at 10:59 AM.
Heh, excuse me... What is full compiler logging?
This link "http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_co mpiler_problem.3F"
http://wiki.codeblocks.org/index.php...ler_problem.3F
Last edited by stahta01; 09-04-2011 at 01:10 PM.
I tried it, but it still does the same. But this time, when I press No, it gets a program window that says that it returned 0 value! I know that I'm tiring you, but I'm tired of all this, too!
Tim S.Q: How do I troubleshoot an compiler problem?
A: I would start by turning on full Compiler logging.
This is done by selecting the "Full command line" option Under menu "Settings" -> "Compiler and Debugger" -> Global compiler settings -> [the compiler you use] -> "Other Setting" tab, "Compiler logging".
This option will make Code::Blocks output the exact commands it uses to compile your code.
Things to remember:
You should review all the commands and their options;
If you don't know what an option or a command does please read the documentation for the compiler/linker you're using;
Look for missing commands;
For every source file (.cpp; .c; .d; etc) in your project, you must have at least one command in the log. This command must produce an object file (file extension ".o" if using gcc/g++ and ".obj" if using Visual Studio);
Every object file should be linked in the final executable, if not there are undefined symbols errors;
Remember the file extension matters: *.c is compiled as C file, *.cpp is compiled as C++ file.
Okay, I put the cin.get(); (I hadn't thought of that, even than I knew about it) but it still won't build. When I build or "build and run", it does nothing, and if I try run, it says "It seems that your program hasn't been built yet. Do you want to build it now?" and if I press Yes, it still does nothing.
What link?
Last edited by Coga1900; 09-04-2011 at 11:33 AM.
I have a suspicion that you only installed the ide, not the compiler, if on windows.Okay, I put the cin.get(); (I hadn't thought of that, even than I knew about it) but it still won't build. When I build or "build and run", it does nothing, and if I try run, it says "It seems that your program hasn't been built yet. Do you want to build it now?" and if I press Yes, it still does nothing.
That is your program running ! Put in some output statements to see what happens.it gets a program window that says that it returned 0 value!
If you get tired of this, wonder what you'll do in future, facing segfaults !
You don't get it. It returns 0 value, but it gets no text! There is a cout, but it only returns the value! Nothing else!
Your reasoning does not follow: just because a file is named "main.cpp" does not mean that it is immune from containing "wrong code".Originally Posted by Coga1900
Have you ever successfully compiled and run a program using Code::Blocks? If not, create a new project and attempt to compile and run this program:
Then tell us what happened.Code:#include <iostream> int main() { std::cout << "Hello world!" << std::endl; }
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
That is the main.cpp!!!! It does nothing!