User forums > Help

Can't build, run, or compile.

<< < (2/3) > >>

MortenMacFly:

--- Quote from: pyro_854 on August 24, 2006, 09:42:32 am ---gcc tar.gz file but it doesn't have an installer... do I need it?
How do I setup the compiler in C::B?

--- End quote ---
Please have a lok here:
http://wiki.codeblocks.org/index.php?title=MinGW_installation
And here (in general):
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks
Yes, you need a compiler to compile (gcc. g++) programs and yes, this needs to be setup. To setup the gcc compiler all you have to do is to provide C::B with the path to the compiler's applications:
- Goto settings -> compiler and debugger
- select the gnu gcc compiler
- switch to the "Programs" tab
- enter the path to GCC (this us the compiler, *not* MinGW), e.g. C:\GCC
This should basically it.
With regards, Morten.

Ps.: Please: before you ask you could also do a search through the forum and the C::B webpage. This would have revealed the WiKi which is full of information, also for beginners.

tiwag:

--- Quote from: pyro_854 on August 24, 2006, 09:42:32 am ---I found the messages window... this is what it says:
----
poo.c:3: iostream: No such file or directory
poo.c:4: error: syntax error before "namespace"
poo.c:4: warning: type defaults to `int' in declaration of `std'
poo.c:4: warning: data definition has no type or storage class
poo.c:8: error: `cout' undeclared (first use in this function)
poo.c:8: error: (Each undeclared identifier is reported only once
poo.c:8: error: for each function it appears in.)
:: === Build finished: 5 errors, 2 warnings ===
----

I used the mingw.exe file to install gcc. I also have a gcc tar.gz file but it doesn't have an installer... do I need it? If so where should I extract to. How do I setup the compiler in C::B?

--- End quote ---

you tried to compile a c++ program with the c compiler, this won't work

please search some tutorials on the net and work through them
e.g. http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

try the attached project

[attachment deleted by admin]

pyro_854:

--- Quote from: tiwag on August 24, 2006, 10:50:11 am ---
you tried to compile a c++ program with the c compiler, this won't work

please search some tutorials on the net and work through them
e.g. http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

try the attached project


--- End quote ---

So I was using the wrong extention? I knew it had to be something simple.

I was working through a tutorial, but when I had this problem I mistook it for a C::B problem.

I fixed the original file and it works... Thanks for the help.

musiKk:
hi there,
i have the same problem and so i didn't want to start a new topic. but the solution is not that simple here since i'm using the right extension. ;)

let's say, i have the following little program:

--- Code: ---#include <iostream>
int main() {
    std::cout << "Hello World!\n";
}
--- End code ---

very basic, very simple, saved under hello_world.cpp.
so when i have the file opened all build, run etc buttons are grayed out as well as the build-menu except for one item: compile current file (which works). well of course this would be all i needed but the run command from other ides was great too because then i didn't have to run the binary file by hand. and of course i can not debug (everything grayed out in debug menu) which is more important. when i look in the compiler settings, everything is correct. for example the entry for debugger is "gdb.exe" and this file can be found at the above given directory (but if this was wrong, the simple compiling wouldn't work).

using xp pro and c::b build: oct24 2006 - wx2.6.1 with gcc which was provided in the c::p setup i installed.

mandrav:
You need to setup a project to have the full functionality...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version