Author Topic: Why does ld.exe ask for dllcrt2.o in CB?  (Read 7456 times)

mango

  • Guest
Why does ld.exe ask for dllcrt2.o in CB?
« on: April 05, 2007, 03:15:25 pm »
Hello!

I'm quite new to all this C world as I come from Java world. However I do understand compiling and linking and I know how to write simple C stuff.

I'm writing a program that is supposed to be an extension to a GIS software, so it's a DLL. CB does a fantastic job with autocompletion and everything, but I have a problem:

Compilation runs fine but linking never happens. I click a second time on the "build" button and the Log says:
Code
-------------- Build: Release in PortillonV2 ---------------
Linking dynamic library: bin\Release\PortillonV2.dll
ld: dllcrt2.o: No such file: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

BTW, to export the symbols from my PortillonV2.dll, I use a definition file.
Now, I can't get past this. Notice I managed to get the dll using the command line, and it doesn't require the dllcrt2.o file... so why does ld ask for it when I use CB?
Code
PS D:\Dani\workspaceC\Portillon\obj\Debug> ld -share -o Portillon.dll main.o dllcrt.o D:\Programmes\Kits\C\Lib\xgo32m.li
b C:\mingw\lib\libcrtdll.a ../../port.def

For completeness: I'm using mingw downloaded today  5/04/2007 as well as the 4/04/2007 CB build for Windows. And I'm running on Vista.

Any help would be greatly appreciated!

Thanks!
Mango!

EDIT: oooh my! I think I might have not posted this in the correct forum. If the moderators want to move it around, feel free to do so. Sorry for the inconvenience.
« Last Edit: April 05, 2007, 03:20:12 pm by mango »

julienlecomte

  • Guest
Re: Why does ld.exe ask for dllcrt2.o in CB?
« Reply #1 on: April 05, 2007, 03:39:20 pm »
Compilation runs fine but linking never happens. I click a second time on the "build" button and the Log says:
Code
-------------- Build: Release in PortillonV2 ---------------
Linking dynamic library: bin\Release\PortillonV2.dll
ld: dllcrt2.o: No such file: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

If you turn on "full command line" in "compiler settings" it will be easier to know where the problem comes from.

Now, I can't get past this. Notice I managed to get the dll using the command line, and it doesn't require the dllcrt2.o file... so why does ld ask for it when I use CB?
Code
PS D:\Dani\workspaceC\Portillon\obj\Debug> ld -share -o Portillon.dll main.o dllcrt.o D:\Programmes\Kits\C\Lib\xgo32m.li
b C:\mingw\lib\libcrtdll.a ../../port.def

For completeness: I'm using mingw downloaded today  5/04/2007 as well as the 4/04/2007 CB build for Windows. And I'm running on Vista.

MinGW does use dllcrt1.o or dllcrt2.o; but I've never heard of a plain dllcrt.o as in your command line. When linking, I also recommend using the "g++" or "gcc" tool instead of "ld" directly. gcc/g++ will call ld with extra "hidden" parameters (not so hidden, they're actually in a file called "specs").


To get to the real point: MinGW has issues with Vista. There's much documentation and help to be found; eg. http://www.google.com/search?q=mingw+vista

You can also subscribe to the mingw lists, and you'll be sure to find some help.

mango

  • Guest
Re: Why does ld.exe ask for dllcrt2.o in CB?
« Reply #2 on: April 05, 2007, 04:34:07 pm »
Thanks!

I turned on the full command line option (I hadn't seen it yet!) and turned back on the "Create .DEF export file" option. This is what I get:
Code
-------------- Build: Release in PortillonV2 ---------------
mingw32-g++.exe -shared -Wl,--output-def=bin\Release\libPortillonV2.def -Wl,--out-implib=bin\Release\libPortillonV2.a -Wl,--dll -L..\..\..\Programmes\Kits\C\Lib -LC:\mingw\lib  obj\Release\main.o   -o bin\Release\PortillonV2.dll -s 
ld: dllcrt2.o: No such file: No such file or directory

Hum, I read some google vista+mingw, and yes, it's surely that. I had the same problem with the cc1.exe and other files, and had to move them to c:\mingw\bin. (I've been using vista for 2 days and.... *rant*)

Well, I'l investigate this a bit more tomorrow, and try to compile by hand (that should be a good exercise). Hopefully this will get fixed soon!

Thanks
Dani