Author Topic: Lib files not found with VC++ Toolkit  (Read 11898 times)

bszente

  • Guest
Lib files not found with VC++ Toolkit
« on: February 09, 2005, 02:38:00 pm »
Hi!

I have an MDI application, which compiles fine with MinGW, but if I change the compiler to VC++ I got the following error:
Code

Project   : Win32 Application
Compiler  : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : D:\Tutorial\mdi\
--------------------------------------------------------------------------------
Switching to target: default
main.cpp
Linking executable: mdi.exe
LINK : warning LNK4044: unrecognized option '/lstdc++'; ignored
LINK : warning LNK4044: unrecognized option '/lgcc'; ignored
LINK : warning LNK4044: unrecognized option '/lgdi32'; ignored
LINK : warning LNK4044: unrecognized option '/lcomdlg32'; ignored
LINK : warning LNK4044: unrecognized option '/lodbc32'; ignored
LINK : warning LNK4044: unrecognized option '/lwsock32'; ignored
LINK : warning LNK4044: unrecognized option '/lwinspool'; ignored
LINK : warning LNK4044: unrecognized option '/lwinmm'; ignored
LINK : warning LNK4044: unrecognized option '/lshell32'; ignored
LINK : warning LNK4044: unrecognized option '/lcomctl32'; ignored
... and so on...
main.o : error LNK2019: unresolved external symbol __imp__DestroyMenu@4 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__TranslateMDISysAccel@8 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__GetMessageA@16 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__LoadMenuA@8 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__LoadBitmapA@8 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function _WinMain@16
main.o : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
...and so on...

I think it does not find the lib files. I have Platform SDK installed, I think it's something to do with bad linking parameters.  Did I do something wrong?

Regards,
bszente

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Lib files not found with VC++ Toolkit
« Reply #1 on: February 09, 2005, 09:46:06 pm »
If you change the compiler, you 'll have to change its options too. CB currently does not support different project compiler options per-compiler. This will change in the future.

Change the linker options manually. Remove stdc++ and gcc from the linker options and to the rest of the linker options, append ".lib".

What I usually do in such cases, is copy the project file (*.cbp) and rename it ti something else. E.g. a project "mdi.cbp" I would copy it to "mdi_vc.cbp". I, then, would open "mdi_vc.cbp" and edit its options to use the VC toolkit.

HTH,
Yiannis.
Be patient!
This bug will be fixed soon...

bszente

  • Guest
Lib files not found with VC++ Toolkit
« Reply #2 on: February 10, 2005, 02:05:02 pm »
Thanks for the help. I succedet to compile with VC Toolkit. I made a copy of the CBP file, as you said, but iI had to remove also these two libs: odbc32
ctl3d32
because they do not exists. And I had to add user32.lib, and  I deleted also the "-l" entri in front of each lib.

I thought that by switching the compiler automatically you change the linker options to be in concordance with the respective linker, but you apply directly the MinGW linker options.

It would be nice to see in the linker options the default ones. By default, when the program creates a new project, you put tghe deafult linker options:
Code
<Linker>
<Add option="-lstdc++"/>
<Add option="-lgcc"/>
<Add option="-lgdi32"/>
<Add option="-lcomdlg32"/>
<Add option="-lodbc32"/>
<Add option="-lwsock32"/>
<Add option="-lwinspool"/>
<Add option="-lwinmm"/>
<Add option="-lshell32"/>
<Add option="-lcomctl32"/>
<Add option="-lctl3d32"/>
<Add option="-ladvapi32"/>
<Add option="-lopengl32"/>
<Add option="-lglu32"/>
<Add option="-lole32"/>
<Add option="-loleaut32"/>
<Add option="-luuid"/>
</Linker>

My problem is that, when I open the Build Options dialog, and I go to the MinGW linker options, the edit box is empty. I don't see these options.

However when I made a copy of the CBP file, and I changed the compiler to VC++ and I modified the linker options (directly in the file), invoking the Build Option dialog  in the linker options edit box the modified entries showed up.

Why is this strange behaviour, in one case they don't show up (the default MinGW), and in the other way they show up (when I changed directly in file)?

Thanks for help, mandrav.

Regards,
bszente

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Lib files not found with VC++ Toolkit
« Reply #3 on: February 10, 2005, 03:37:05 pm »
Quote from: bszente
My problem is that, when I open the Build Options dialog, and I go to the MinGW linker options, the edit box is empty. I don't see these options.

It's a strange "bug" in the text control. The entries are there, you just have to scroll-up to see them  :roll: ...

Yiannis.
Be patient!
This bug will be fixed soon...

bszente

  • Guest
Lib files not found with VC++ Toolkit
« Reply #4 on: February 10, 2005, 04:02:05 pm »
Oh, I see.  :oops:  I thought that it's empty, and I did not try to scroll up.
This is not in fact a bug, rather normal behaviour. When you insert texts in an edit control, the control automatically puts the cursor after the last character. This is happening also here. Try to send a message for the edit control, to move the cursor to the first line.

What an ease  :D  I thought that I should modify these linker options directly in the project file file, not by the mean of Build Options dialog.

Thanks again. Everything is ok now.

bszente

  • Guest
Lib files not found with VC++ Toolkit
« Reply #5 on: February 10, 2005, 07:24:28 pm »
You may try to remove the Select All from the linker option edit control. I think that's the source of problem, this puts the cursor at the end, and force a scroll/page down, and the disappearing of lib list.