How to compile using EiffelStudio? VD43 Precompiled file is missing or unreadable (...)/driver.exe - External C compilation failed - eiffel

After installing EiffelStudio I can't compile and run any project because I always get VD43 warning and C Compiler Error.
2 VD43 Precompiled file is missing or unreadable. File 'c:\users\username\documents\eiffel user files\19.05\precomp\spec\win64\EIFGENs\base-scoop-safe\W_code\msc_vc140\driver.exe'.
1 C Compiler Error Please review the External Compilation output of the Outputs Tool.
Error code: C Compiler Error
Error: External C/C++ compilation failed.
What to do: Check the external C/C++ compilation for details.
Please review the External Compilation output of the Outputs Tool.
I found this page: https://www.eiffel.org/doc/version/trunk/faq/FAQ. The key ISE_C_COMPILER must be additionally defined in order for EiffelStudio to work at all. But how does one "Tell EiffelStudio to use Visual Studio 2017-compatible libraries"? I tried setting it as an environment variable, and changing the compile_library.bat and esvars.bat, so that in every place it's set ISE_C_COMPILER=msc_vc140. I also added variable ISE_C_COMPILER - msc_vc140 on the EiffelStudio GUI, under Project->Project Settings->Target:project->Advanced->Variables
I deleted all the projects and the precomp folder. I ran espawn -l just to verify that I have the good c++ compiler:
Available C/C++ compilers:
VC160: Microsoft Visual Studio 2019 VC++ (19.0)
VC150: Microsoft Visual Studio 2017 VC++ (15.0)
To me it seems that I installed everything and I set every variable but it still gives me the same warning and error.

Related

Why can Visual Studio 2017 Developer Command Promt only open "stdio.h" in Administrator mode?

I am trying to do simulation using Delmia. This requires a functioning C compiler. When i test my C compiler in Delmia, which tries to compile a very simple source file that includes stdio.h, I get the error "Cannot open include file: 'stdio.h': No such file or directory":
Compiling and linking the model (Visual C++).
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.6.2
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
Guessed compiler version: 1913
"Testing 32-bit compilation"
dsmodel.c
dsmodel.c(1): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
Error generating Dymosim.
It seems to be entirely the same issue as:
Visual Studio 2017 for Dymola cannot open stdio.h
His solution is not descriptive enough for me to solve my issue, as his "IT dept" apparently solved it for him, but he mentions allowing access to regedit which I do not understand the reason for in this context.
I have tried to recreate the error that Delmia generates by compiling dsmodel.c with VS2017 Developer Command Promt. If I run the command prompt in Administrator it compiles fine, if I do not, I get the samme error as Delmia outputs. Why is this?
If I find a solution such that I can compile it with command prompt without being in Administrator mode, then should Delmia not also be able to? How can i achieve this?
Some additional information: I have installed Visual Studio not on my main drive, and the Windows SDK is in program files on my main drive. Does this have any relevance?
Edit: For anyone else with this issue in Delmia, I would suggest simply installing another compatible compiler as a work-around. I installed MinGW which works well, even though this additional compiler takes up 500 MB. Remember that it has to be 64-bit. I used the "MingW-W64-builds" from http://mingw-w64.org/doku.php/download

How to solve libatomic issue in windows?

I am developing executables from source code of llvm. So I downloaded the llvm source code from github.
I am trying everything from command line on Windows OS
I am following the link for libtooling in clang
http://clang.llvm.org/docs/LibASTMatchersTutorial.html
I tried with 2 options
Option First: I ran the below command
cmake -G Ninja "C:\Users\amith.ks\Desktop\Clang-llvm\llvm-project\llvm" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release
Everything Worked..
Second option:
I wan to set cmake_c_compiler and cmake_cxx_compiler from command line.
I dont want to use cmake-gui so I run the below command
cmake -G Ninja "C:\Users\amith.ks\Desktop\Clang-llvm\llvm-project\llvm" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
From out of no where error was thrown
CMake Error at cmake/modules/CheckAtomic.cmake:53 (message):
Host compiler appears to require libatomic, but cannot find it.
Call Stack (most recent call first):
cmake/config-ix.cmake:343 (include)
CMakeLists.txt:617 (include)
When I saw the cmake error log It was saying this
LINK : fatal error LNK1104: cannot open file 'atomic.lib'
clang: error: linker command failed with exit code 1104 (use -v to see invocation)
ninja: build stopped: subcommand failed.
I searched my whole pc atomic.lib no where to be found.
How to solve this issue on windows?
Please help me with answers.
I know why it fails. It's a bug in the LLVM's cmake files. In order to check if atomic.lib is required CheckAtomic.cmake tries compiling and linking a piece of code with atomic.lib. When it fails (because atomic.lib is not required and thus is not present) it falsely concludes that atomic.lib is needed. LLVM's cmake files is a hot mess with rarely fixed bugs. There are bugs staying there for years. I guess this is because nobody understands anymore how LLVM build system works.
Long story short, I couldn't find why CheckAtomic.cmake inserts atomic.lib while checking that it is not required. As a workaround I just unconditionally set HAVE_CXX_ATOMICS64_WITHOUT_LIB and HAVE_CXX_ATOMICS_WITHOUT_LIB to True in CheckAtomic.cmake:
set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
Use clang-cl (or MSVC cl), they dont require lib atomic.
I'm trying to use Clang 11 (with MSVC ABI) to compile Clang 11. However, MSVC's headers won't compile in C++11 mode, which CheckAtomic.cmake uses:
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
results in:
C:\Users\nyanpasu\code\llvm-project>clang -Werror=unguarded-availability-new -std=c++11 uwu.cpp
In file included from uwu.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\atomic:19:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xatomic.h:13:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\type_traits:11:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xstddef:283:22: error: 'auto' return
without trailing return type; deduced return types are a C++14 extension
_NODISCARD constexpr auto _Unfancy(_Ptrty _Ptr) noexcept { // converts from a fancy pointer to a plain pointer
^
1 error generated.
I don't know if this is a MSVC bug where it ships an header incompatible with C++11, or a Clang bug where it's using MSVC headers instead of its own.
In any case, changing c++11 to c++14 fixes this error.
As lulle mentioned, you need to use the right tools to compile. If you have installed Visual Studio, use the Developer Command prompt for Visual Studio instead of a regular cmd and you'll have the environment variables you need. It is located in your Visual Studio installation directory, under the Tools subdirectory.
For example:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat
I encountered the same error in macOS. Adding the CPP Libraries to the path solved it for me. You can try executing the following commands.
export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
export CPLUS_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1

How to use VC++ compiler in command line(Windows)?

I tried to use VC++ commandline, instead of MinGW compiler for windows system programming. I wrote a simple hello world program and tried to compile it, then i got this error message.
test2.c(1): fatal error C1083:'stdio.h': No such file or directory
I also added "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\Hostx86\x86" directory (where c1.dll lives) to the System Envionment Variable(PATH).
How can I fix this issue? Other tutorials don't give much information about VC++. (A lot of MinGW compiler tutorial out there btw)
You should use visual studio command line if you want to compile or run program with the help of vc++ compiler.
Else all information related to setting environment variables ETC. resides in this MSDN document.

error LNK2001: unresolved reference with Pro*C code with Visual C++

I'm getting an error when trying to build a DLL file with a C file preprocessed with Pro*C, the command I'm using to build my dll is:
link /NOLOGO /DLL /SUBSYSTEM:WINDOWS /NODEFAULTLIB:libc.lib /IMPLIB:orasql11.lib /IMPLIB:orasqx11.lib /OUT:qvc.dll\
/IMPLIB:oraxa11.lib /IMPLIB:oci.lib \
/LIBPATH:"$(ORACLE_HOME)\precomp\lib\msvc" /LIBPATH:"$(ORACLE_HOME)\precomp\lib" #files.lnk
The error is:
error LNK2019: unresolved external symbol _sqlcxt
How can I fix this?
The /IMPLIB option is to specify a name for an import library that's being created - instead you want to have the linker use the ProC libraries as input:
link /NOLOGO /DLL /SUBSYSTEM:WINDOWS /NODEFAULTLIB:libc.lib orasql11.lib orasqx11.lib /OUT:qvc.dll\
oraxa11.lib oci.lib \
/LIBPATH:"$(ORACLE_HOME)\precomp\lib\msvc" /LIBPATH:"$(ORACLE_HOME)\precomp\lib" #files.lnk
I got the same message trying to link an oracle database application using the same visual C++ 2005 project as before but with oracle12c instead of oracle 11.
It seems that the orasql12.lib was generated with a code that add an underscore as prefix but visual studio needs an import library without leading underscore.
So I fix this problem by regenerating the orasql12.lib. For this, you must use the DUMPBIN and LIB commands in a visual studio tool command line console. Open the VC++ command line console in the directory where the oraclesql12.dll was installed and type:
DUMPBIN /EXPORTS orasql12.dll > orasql12.def
this will generate a def file that you have to edit in order to remove all except the name column symbols and add two header lines, the firts lines of your orasql12.def file will look like this:
LIBRARY orasql12
EXPORTS
DSNTIAR
ORASQL8
...
then use LIB command in VC++ tools console and type:
LIB /DEF:orasql12.def /MACHINE:X86 /LIBPATH:D:\users\Appl\oracle\client_12c\bin
(LIBPATH is set to the orasql12.dll installation directory, change X86 if needed)
A new orasql12.lib has been generated without leading underscores.
error LNK2019: unresolved external symbol _sqlcxt on **Visual Studio VC++ Error Solved**
If you are using Oracle Client you might have this Error because of the corrupted Libraries (may be) . such as orasqx12.lib and orasqx12.lib . There might be some bugs with these libraries. if you have downloaded Oracle Client 12.2.0.1 or may be with Earlier Versions you will be fine. However if you are downloading 64bit version of Oracle database or Oracle Client
you must change your Visual Studio Platform to **64bits instead of 32bits at the Configuration Manager of the Project Solution.**
If you are a beginner and trying to learn how to use Pro* C with your Visual Studio , You might want to Download the Oracle Database 11g release 2 Express Version. because that library file (orasql11.lib) works fine without giving you this Error **_sqlcxt .**
I would say this Error is caused by the library, Its looking for function defined in that library and it is could not find it , may be because its corrupted. I am not sure. since there are a lot of people have this problem and I decided to post this. Also this is only for the beginners who are trying to learn Pro* C with Visual Studio. Not for the Experts. also You may not get this Error with the Standard Edison of Oracle database.
.

CMake Error at 3rdparty/libtiff/CMakeLists.txt:27 (ocv_include_directories): Unknown CMake command "ocv_include_directories"

Right, so I'm trying to build a project in VS2012 and I've been chasing down various errors for the past 2 days...I'm coming in on a lot of legacy code, and it deals with OpenCV2.1
So after chasing down all the 3rd party files I needed, I now get the following error:
error C1021: invalid preprocessor command 'cmakedefine' c:\opencv2.1\3rdparty\libtiff\tif_config.h
Line:
/* Define to 1 if you have the <assert.h> header file. */
#cmakedefine HAVE_ASSERT_H
Which the only help I found here:
cannot compile allegro using visual c++
suggesting that I need to rebuild OpenCV with cmake. At which point I get the error:
CMake Error at 3rdparty/libtiff/CMakeLists.txt:27 (ocv_include_directories): Unknown CMake command "ocv_include_directories".
In the visual editor. So I traced that to here.
So I run it in command line as:
cmake C:/OpenCV2.1 -DBUILD_SAMPLES=ON
Which spits out more errors:
CMake Error at 3rdparty/libtiff/CMakeLists.txt:5 (project):
project PROJECT called with incorrect number of arguments
CMake Error at 3rdparty/libtiff/CMakeLists.txt:27 (ocv_include_directories):
Unknown CMake command "ocv_include_directories".
I can't find any documentation for ocv_include_directories. I've tried following multiple OpenCV cmake tutorials, but haven't had any success.
It turns out the problem was actually that I had visual studio 2012, and the codebase I was working in was visual studio 2008 built. There was no possibility to ever track down all of these errors. Solution was to uninstall 2012 and install 2008.

Resources