Author Topic: libstdc++  (Read 1317 times)

Offline somniantis

  • Single posting newcomer
  • *
  • Posts: 5
libstdc++
« on: December 24, 2016, 03:26:30 am »
Update: So I've found out that codeblocks does link this statically. I was thrown off because I thought the "full command line" build log reflected all the commands sent to gcc. I learned to program using IDEs and now I'm finding out what they're doing in the background without telling me!



Ok, so when I build a simple c++ program through codeblocks which includes <iostream>, the executable runs just fine on its' own with no apparent runtime dependencies.

But why? libstdc++6.dll is not in the executable path nor the project path and there's no static linking going on in the build log.

Is codeblocks silently telling my linker to link libstdc++ statically? (and what about libstdc++'s own runtime dependencies?) How is this getting linked? Is codeblocks omitting things from the build log?

I'm just trying to get a deeper understanding of what exactly is happening.
« Last Edit: December 24, 2016, 05:35:31 am by somniantis »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6535
    • My Best Post
Re: libstdc++
« Reply #1 on: December 24, 2016, 03:44:46 am »
Code::Blocks automatically adds folders to the path used inside Code::Blocks. I know it adds the linker search folders for a fact.

So, run the exe from the command line and see if it works from there.

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

Offline somniantis

  • Single posting newcomer
  • *
  • Posts: 5
Re: libstdc++
« Reply #2 on: December 24, 2016, 03:57:43 am »
Code::Blocks automatically adds folders to the path used inside Code::Blocks. I know it adds the linker search folders for a fact.

So, run the exe from the command line and see if it works from there.

Tim S.

Well, the exe runs from anywhere on the system, so it must be statically linked to libstdc++, right? As far as I can tell, the dll is not in any directory on my system PATH.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11770
    • Travis build status
Re: libstdc++
« Reply #3 on: December 26, 2016, 04:40:51 pm »
1. CB doesn't link anything. The compiler/linker do this.
2. If it is static or dynamic depends on the default mode of the linker or on special flags
3. CB doesn't pass special flags for this by default
4. Have you tried depends.exe? It will tell you all dependencies of windows executables
5. Where is libstdc++.dll on your disk?
(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!]