Author Topic: Unable to Run a project  (Read 5975 times)

ChrisC

  • Guest
Unable to Run a project
« on: April 25, 2006, 06:52:31 pm »
Hi,

I just started learning C++ and I installed Code::Blocks 1.0-RC2.

I have Windows XP Pro and Code::Blocks is installed in:
C:\Program Files\CodeBlocks

I just created a new console project (a simple "Hello World!") and I saved all the files in:
C:My Documents\CodeBlocks\Projects\Test

Compile goes without a problem.

When I click run, from within Code::Blocks, I get a command prompt screen with the following message:

'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.

When I double click directly on the test.exe file, a screen appears and then disappears a split second later.

When I try to run the test.exe file from run>cmd command prompt, I get the following message:

'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.

I've searched the forums and the internet but I'm unable to find a working solution. Please help.

Chris

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Unable to Run a project
« Reply #1 on: April 25, 2006, 07:10:03 pm »
I just started learning C++ and I installed Code::Blocks 1.0-RC2.

Do not use RC2 (is a bit old now). Use the latest nightly build instead. Get it here:

http://forums.codeblocks.org/index.php?board=20.0

When I double click directly on the test.exe file, a screen appears and then disappears a split second later.

This is normal. You double click on the consol application (test.exe), the program run or crashes and then the command window is immediately closed.

Anyway, try not to use pathes with white spaces, e.g., C:\My Documents, but rather C:\MyDocuments.

Best wishes,
Michae

ChrisC

  • Guest
Re: Unable to Run a project
« Reply #2 on: April 25, 2006, 08:20:45 pm »
First of all, thank you Michael for helping me resolve my problem.  :P

For the benefit of those who may have a similar problem, this is what I did to resolve it:

I created a new directory for my project files:

C:\CodeBlocks
No white spaces in the path as per Michael's advice.

I downloaded the latest Nightly build and extracted it to:

C:\Program Files\CodeBlocks\CBNB

I then added mingwm10.dll and wxmsw26u_gcc_cb.dll to the above directory.

Afterwards, I launched the Code::Blocks application from within:

C:\Program Files\CodeBlocks\CBNB

Everything loaded fine.

Finally I created a new "Hello World" console project, compiled it, and runed it.
Everything went well and my code executed as it was supposed to.

Now, as this is the first time I use the Nightly builds, should I copy the lib folder and other folders or files from the initial Code::Blocks folder:

C:\Program Files\CodeBlocks\

to the Nightly build folder?:

C:\Program Files\CodeBlocks\CBNB


Thanks again for your help!

Chris

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9524
Re: Unable to Run a project
« Reply #3 on: April 25, 2006, 08:34:37 pm »
Now, as this is the first time I use the Nightly builds, should I copy the lib folder and other folders or files from the initial Code::Blocks folder:
Well, once you've managed to install a nightly you might also be interested to intall MinGW from Mingw.org seperately. This is the same compiler as it ships with C::B-RC2. If you don't want to do this it is safe to copy the following folders to your nightly folder:
- bin
- doc
- include
- info
- lib
- libexec
- man
- mingw32
And nothing else. Again: You may want tot seperate the IDE from the compiler(s). Thus you could also copy these folders into another folder and setup the compiler path's for the binaries, includes and libs in your nightly accordingly.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

ChrisC

  • Guest
Re: Unable to Run a project
« Reply #4 on: April 25, 2006, 08:57:31 pm »
Thanks Morten for the advice. The idea of separating the IDE from the compiler sounds interesting. But to do so, are the following steps the way to do it?

Download and install MinGW-5.0.2

Replace the contents of initial Code::Blocks folder:
C:\Program Files\CodeBlocks\
with the contents of the Nightly build folder:
C:\Program Files\CodeBlocks\CBNB

Setup the compiler path's after launching Code::Blocks.

Something tells me I'm missing someting...

Chris

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: Unable to Run a project
« Reply #5 on: April 25, 2006, 09:02:01 pm »
  • Trash RC2. Delete it. You don't need it.
  • Install MinGW. The 5.0.2 installer is good; C:\MinGW is generally a good place to install it. (Code::Blocks will autodetect it if you install it there.)
  • Ensure that "C:\MinGW\bin" is in your PATH environment variable. If you don't know how, don't worry about it.
  • Download and extract the codeblocks nightly build .7z and the wxmsw26u .7z files, to an entirely clean directory. If you don't have C:\MinGW\bin in your path, copy mingwm10.dll from there to the Code::Blocks directory.
  • Run Code::Blocks.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

ChrisC

  • Guest
Re: Unable to Run a project
« Reply #6 on: April 25, 2006, 09:30:22 pm »
Thanks TDragon for the reply. As I suspected, I was missing something...

So, if I understand correctly:

  • I delete the folder where RC2 is installed:
    C:\Program Files\CodeBlocks\
  • I install MinGW-5.0.2. Is it ok to install only the MinGW base tools and g++ compiler? I only code in C++ at the moment and don't have much space in my computer.
  • Ensure that "C:\MinGW\bin" is in my PATH environment variable.
  • Create a clean new directory:
    C:\Program Files\CodeBlocks\
  • Extract the contents of the Nightly build and copy wxmsw26u_gcc_cb.dll to the above folder.
  • Run Code::Blocks.

Anything else I need to do?

Chris

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9524
Re: Unable to Run a project
« Reply #7 on: April 25, 2006, 09:57:49 pm »
  • I install MinGW-5.0.2. Is it ok to install only the MinGW base tools and g++ compiler?
It is essential (good) to install these packages:
- mingw-runtime-3.9
- w32api-3.7
- binutils-2.16.91-20060119-1.tar.gz
- gcc-core-3.4.5-20060117-1.tar.gz
- gcc-g++-3.4.5-20060117-1.tar.gz
- gdb-6.3-2_snapshot
- mingw32-make-3.80.0-3
optional (if you like Fortran) you may install:
- gcc-g77-3.4.5-20060117-1.tar.gz
Anyway, please note that the version is the currently "most up-to-date" and may not be offered by the MinGW 5.0.2 installer. In that case eigther you choose the version that is offered by the installer or download and extract the packages manually from MinGW.org. Please note that the easiest way maybe to copy the appropriate folders from the C::B-RC2 folder as listed in my earlier post.
With regards, Morten.
« Last Edit: April 26, 2006, 08:26:14 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

ChrisC

  • Guest
Re: Unable to Run a project
« Reply #8 on: April 26, 2006, 08:13:37 am »
Thank you everyone for clarying things for me.

After following the above instructions, I was able to install Code::Blocks IDE separate from MinGW compiler.

Everything is working well and I'm now able to concentrate on learning C++.

Thanks again for all your help!

Chris