User forums > Using Code::Blocks

Lib files not found with VC++ Toolkit

(1/2) > >>

bszente:
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 [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function [email protected]
main.o : error LNK2019: unresolved external symbol [email protected] referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" ([email protected]@[email protected]@[email protected])
...and so on...
--- End code ---

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

mandrav:
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.

bszente:
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>
--- End code ---

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

mandrav:

--- 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.
--- End quote ---

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

Yiannis.

bszente:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version