Author Topic: running code blocks programs directly from command prompt  (Read 2935 times)

Offline welderrprman

  • Single posting newcomer
  • *
  • Posts: 3
running code blocks programs directly from command prompt
« on: November 22, 2021, 01:06:54 am »
I am new to code blocks.  Using it as an ide in replacement of visual studio.net 2003.  Previously have studied C, C++ and C# a number of years ago and want
to come up to speed again.  I try running some of my starter programs developed in code blocks directly from the command prompt and not in code blocks ide.
I keep getting the message that I am missing a .dll file.  Other programs do start directly in the command prompt environment.  Is there a way to get around this?

Offline AndrewCot

  • Regular
  • ***
  • Posts: 313
Re: running code blocks programs directly from command prompt
« Reply #1 on: November 22, 2021, 03:41:36 am »
What is the exact error message you are getting? (Depending on the error message depends on the fix)
What version of C::B did you install? (Also depending on the version depends on the fix)
What is the exe/zip filename of the C::B file you downloaded?  (Also depending on what file you used depends on the fix)
What directory did you install the C::B exe? (This is to check that the version of C::B will run okay in the directory you installed it in)

If you downloaded the nightly files please click on the "how it works" hyperlink in the nightly post that is the the red text. It will explain how to use/setup the nightly builds.

Offline gd_on

  • Lives here!
  • ****
  • Posts: 686
Re: running code blocks programs directly from command prompt
« Reply #2 on: November 22, 2021, 09:22:37 am »
Your message is not enough explicit, but if the missing dll(s) is in the bin subdirectory of your compiler (probably a MinGW), add simply this full bin path to your PATH variable (your system one or your user one : easier if you are not admin).
For your information, Code::Blocks adds this path for his own usage, it's why your code works inside code::blocks, but the Windows general path is not modified: it's why dll is missing because Windows does not know where to find it (or them). More, if you want to distribute your code, it may be neccessary to add those dll to your distribution in the same directory where your exe is. You can also copy those dll in your exe directory for yourself, but I prefer the first solution : modifying the PATH variable.

NOTE : this question has been asked many many times on this forum. Use the search button with "miising dll" (for example) as the search key !
« Last Edit: November 29, 2021, 05:36:33 pm by gd_on »
Windows 10 64 bits (21H2), svn C::B (last version or almost!), wxWidgets 3.1.5, Msys2 Compilers 11.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).

Offline welderrprman

  • Single posting newcomer
  • *
  • Posts: 3
Re: running code blocks programs directly from command prompt
« Reply #3 on: November 27, 2021, 03:12:02 pm »
Yes I saw in the files that this question has been asked before.  The error message  states it cannot find libstdc++-6.dll.  In the process of using a utube video to work around this.  Release 20.03 rev 11983     Program is on c: \c++programs

Offline welderrprman

  • Single posting newcomer
  • *
  • Posts: 3
Re: running code blocks programs directly from command prompt
« Reply #4 on: November 27, 2021, 03:31:53 pm »
I see the libstdc++-6.dll file in code blocks.  Is it possible to copy that file into my projects?  How would I link that to my projects so that I can go directly into command prompt and run the programs from there?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 909
Re: running code blocks programs directly from command prompt
« Reply #5 on: November 27, 2021, 07:41:44 pm »
As gd_on said you should use libstdc++-6.dll from the bin folder of your MinGW installation (the one you used to compile your program). The one near CodeBlocks may be from another version of the compiler, it may work at first but can give you errors later.

Copy it to the folder containig your executable, you may need to copy others afterwards.