Author Topic: Is possible to use visual studio 2015 c++ compiler with Code::Blocks?  (Read 10465 times)

Offline 4535992

  • Single posting newcomer
  • *
  • Posts: 2
Hi, i've tried to use codeblocks with the Visual Studio 2015 c++ compiler, i follow all the advise on the internet and now i get this on my compiler oprions:

Toolchain Executables: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
Searchs DIrectories: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include"
                                 "C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"
                                 "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\include"
                                  "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include"
Linker Settings: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\lib\VsGraphicsHelper.lib"
                          "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\lib\atls.lib"
Seems all right, but in the end i get this error:

link.exe /nologo /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib" /out:bin\Debug\test2.exe "C:\Program Files (x86)\Microsoft Visual Studio 14.0\lib\VsGraphicsHelper.lib" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\lib\atls.lib" obj\Debug\main.obj 
LINK : fatal error LNK1104: cannot open file 'libcpmt.lib'
Process terminated with status 1104 (0 minute(s), 5 second(s))
1 error(s), 0 warning(s) (0 minute(s), 5 second(s))


I found many discussion on the web about this problem, but i not solved yet, anyone have encounter the same issue?
Ty in advance.
Greetings.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Does the file "libcpmt.lib" or "cpmt.lib" exist on your computer?

If yes, what is the path to it? And, the filename is?

If no, then the compiler can NOT use a library that is NOT on your computer!

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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Linker Settings: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\lib\VsGraphicsHelper.lib"
                          "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\lib\atls.lib"
Why and where are you adding these? I doubt they are needed!
(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!]

Offline 4535992

  • Single posting newcomer
  • *
  • Posts: 2
Ty very much for all the advises. I put below all the procedure i do in my intent to make it work the compiler c++ of visual studio with code::block
for anyone can found this useful.

SET UP SEARCH DIRECTORIES (note avoid the last "/") go to Settings -> Compiler -> Select Visual Studio 2010 Compiler -> Search Directories ->:
Compiler :
            C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
            C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\include
            C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
            C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include
Linker :
                C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
            C:\Program Files (x86)\Windows Kits\8.1\Lib
            C:\Program Files (x86)\Windows Kits\10\Lib
            C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86
            C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86
Resource Compiler:
            C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include
            C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
            
NOTE: THIS CAN BE WORK WITH OTHER COMBINATION OF LIBRARY AND RESOURCE I JUST GIVE A IDEA OF THE PROBLEM NOT ALL THIS DIRECTORIES ARE NECESSARY

Now i put all the exception i have encounter try to build a simple hello programm with the solution i have used :
Ty very much for the advise.

Exception 1:
LINK : fatal error LNK1561: entry point must be defined

Solution 1: Settings -> Compiler -> Select Visual Studio 2010 Compiler -> Linker Settings  -> Other Link Options -> ADD "/SUBSYSTEM:CONSOLE"

Exception 2:
link.exe /nologo /subsystem:windows /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\lib\"  /out:TestApp.exe  Debug\TestAppDlg.obj Debug\stdafx.obj Debug\TestApp.obj  Debug\TestApp.res
LINK : warning LNK4001: no object files specified; libraries used
LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
LINK : fatal error LNK1159: no output file specified

Solution 2: Make sure to remove or the final "/" from all the Search Directories (Compiler,Linker,Resources Compiler);

Exception 3:
link.exe /nologo /subsystem:windows /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\Lib" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86" /out:bin\Debug\test3.exe  obj\Debug\main.obj 
LINK : fatal error LNK1104: cannot open file 'libucrt.lib'

Solution 3: Settings -> Compiler -> Select Visual Studio 2010 Compiler -> Search Directories -> Linker  ->

-> Add  "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86" (if you use 32 bit)
-> Add  "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64" (if you use 64 bit)

Exception 4:
.......
LIBCMT.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh@@YAHXZ)
bin\Debug\test3.exe : fatal error LNK1120: 1 unresolved externals

Solution 4: Settings -> Compiler -> Select Visual Studio 2010 Compiler -> Linker Settings -> Other Linker Settings ->  ADD "/SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt"

Exception 5: The console outout of the program open and close instant

Solution 5: The Last Problem is caused from the use of  "/SUBSYSTEM:CONSOLE " the program is work but the console open and close istant for now i just use like temporary solution tha code "system("pause");"
 at the end of the main method theonly problem is that can't be work with the debugger.
 
 
 NOW WE MUST SET UP THE DEBUGGER:
 
 - Go to the page https://msdn.microsoft.com/en-us/library/windows/hardware/ff551063(v=vs.85).aspx
 - Install the debugger how you more like it
 - Check where the file cdb.exe is located and add the path to the Settings -> Debugger -> Executable Path
 
 Exception5:
 *** WARNING: Unable to verify checksum for image00090000
*** ERROR: Module load completed but symbols could not be loaded for image00090000
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\CRYPTBASE.dll -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\SspiCli.dll -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\msvcrt.dll -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\sechost.dll -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\ADVAPI32.dll -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\bcryptPrimitives.dll -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\RPCRT4.dll -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\KERNEL32.DLL -
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SysWOW64\KERNELBASE.dll -

Solution5: Download SYmbole for windows debug from https://developer.microsoft.com/en-us/windows/hardware/download-symbols AND Setup the enviroment variable "_NT_SYMBOL_PATH"

At this point i will try to make it work the debuggger. hope to update this post.
Greetings All.
« Last Edit: June 16, 2016, 10:56:10 pm by 4535992 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Do you have a project?
If not please create one.
And set the target type to console it should be enough to make it compile simple console application.
Also try if older compilers vc++ 2010/2012/2013 work if possible.
(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!]