Author Topic: standalone independant executable using code::blocks with Windows8  (Read 6766 times)

Offline loo_nice

  • Single posting newcomer
  • *
  • Posts: 2
Hello,

I have developed a c++ console application project with code::blocks in windows using OpenCV 2.4.9. I have built OpenCV using CMAKE (with the BUILD_SHARED_LIBS flag OFF). Regarding Code::blocks, I have downloaded and installed the IDE alone and then I have installed the MingW/Msys compiler.

The application runs normally in Debug and in Release modes. However, when I run the released "exe" it generates an error saying that a DLL is missing. Based on this, I came to the conclusion that the compiler was performing dynamic linking. I have looked everywhere in the code::blocks' GUI to see if there was an option that enables static linking but I did not succeed. I have also looked for help online (googled it) for 2 days but the solutions I have found did not work.

Please, does anyone know how to generate a standalone independant executable (that will work in another PC. i.e: static linking) of a project that uses OpenCV in code::blocks ?

Thank you for your help !

L.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: standalone independant executable using code::blocks with Windows8
« Reply #1 on: August 08, 2014, 07:43:14 pm »
Code::Blocks is NOT a Compiler.
Please read the FAQs; learn the name and version of your compiler. http://wiki.codeblocks.org/index.php?title=FAQ
Find a site that supports your compiler; ask them what compiler/linker options are needed.
FYI: You should also post the name of the DLL that is missing.

Then you can ask here how to use Code::Blocks to add the options.
NOTE: Since you are using CMake you might have to ask the CMake people how to do it.
Depends on the type of project being created by CMake.

You might wish to read the rules you agree to by posting on this site. http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline loo_nice

  • Single posting newcomer
  • *
  • Posts: 2
Re: standalone independant executable using code::blocks with Windows8
« Reply #2 on: August 08, 2014, 11:13:37 pm »
@stahta01,

I don't understand why you are addressing me the way you do it. I came here to ask a question that is related to code::blocks. I do not see where in my post I am saying that code::blocks is a compiler (when I speek of compiler I am speeking of mingW). If you did not understand what I was saying I will tell it to you in a simpler way : "is there a setting on code::blocks to perform static linking ?". Therefore I fairly do not think my post is out of topic. I did not come here to be "attacked". It is not the first time I participate to forums and I always respect the rules. the fact that you "live" here does not give the right to adress people you do NOT know in an agressive way.

Regards.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: standalone independant executable using code::blocks with Windows8
« Reply #3 on: August 08, 2014, 11:31:29 pm »
FYI: You should also post the name of the DLL that is missing.
Why don't you start by posting the missing DLL instead of feeling offended.
Static linking depends on the compiler you're using and the libraries you're linking. And it is not always possible.

Just a guess: To fix your problem just copy the dll next to the executable and it should work. C::B adjusts the PATH variable to make things work out of the box in the IDE even if the setup is not totally correct.


(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]