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.
.
Related
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.
I am writing code in C using GTK as GUI toolbox. I installed GTK3 via MSYS2 and managed to compile and build using GCC (TDM-Dragon) alright.
However, lately I am trying to compile and link using cl included in Visual Studio Community 2017 (heard it is faster and more stable). With this, I am having a hard time building an application. I am loosely following this tutorial:
http://www.tarnyko.net/en/?q=node/22
I created a BAT file and invoke it from the VS 2017 command prompt:
set GINC_PATH="C:\msys64\mingw64\include"
set GLIB_PATH="C:\msys64\mingw64\lib"
cl gtk3test.c -I"%GINC_PATH%\gtk-3.0" -I"%GINC_PATH%\glib-2.0" -I"%GLIB_PATH%\glib-2.0\include" -I"%GINC_PATH%\pango-1.0" -I"%GINC_PATH%\cairo" -I"%GINC_PATH%\gdk-pixbuf-2.0" -I"%GINC_PATH%\atk-1.0" -Dinline= /link /LIBPATH:%GLIB_PATH% gtk-3.lib gdk-3.lib gobject-2.0.lib glib-2.0.lib
This compiles alright, gives me gtk3test.obj. However, the linker returns the following error:
LINK : fatal error LNK1181: cannot open input file 'gtk-3.lib'
What am I doing wrong here? How would it be possible to use cl for linking GTK3 applications?
Thank you all in advance!
Xuttuh
Please check if you have gtk-3.lib in your folder path [%GINC_PATH%]. Even I have this issue using GTK+3.0, the package configuration is not giving the proper library reference.
The gtk library is something like gtk-win32-3.0.lib available inside lib folder %GINC_PATH%\lib in your case.
I still have issues in linking GTK libraries in my visual studio application even after providing the needed library references in Linker.
it is the third day that I am trying to set up the visual studio 2013 with the GTK libraries. I need to use VS: I've used GCC (both command line and with code blocks) in the past (both on windows and slackware linux too..), but now I have a lot of projects in VS and I want to start making some GUI for them. After seeing that the so called "all-in-one-bundle" is not more available/maintained in the GTK website, I followed a bunch of tutorials (including GTK+ 3.0 setup in Visual Studio 2013, How to configure gtk on Visual studio 2010, How do you install GTK+ 3.0 on Windows?) and I started to install MSYS2 according to this one: https://blogs.gnome.org/nacho/2014/08/01/how-to-build-your-gtk-application-on-windows/.
Maybe the problem is here: I followed this step properly pacman -S mingw-w64-x86_64-toolchain, but I skipped the creation of PKGBUILD file and successive installation due to the fact that I did not understand the procedure. Furthermore the mingw toolchaing seemed to be already installed.
Sorry for the big introduction, I wanted to be specific.
The problem is at the linking-stage of Visual Studio C Project building. I had also some problem at compilation involving the different inline interpretation of VS (added #define inline __inline // Necessary to make the GTK library Visual Studio compatible definition before calling the GTK header). The linking stage issue consist in the fact that, using pkg-config --libs gtk+-3.0 --msvc-syntax command, I receive a list of files (/libpath:C:/msys64/mingw64/lib gtk-3.lib gdk-3.lib gdi32.lib imm32.lib shell32.lib ole32.lib -Wl,-luuid winmm.lib dwmapi.lib z.lib pangowin32-1.0.lib pangocairo-1.0.lib pango-1.0.lib atk-1.0.lib cairo-gobject.lib cairo.lib gdk_pixbuf-2.0.lib gio-2.0.lib gobject-2.0.lib glib-2.0.lib intl.lib) that does not exists in the msys2 directory. As a consequence I receive this error from the linker: error LNK1104: cannot open file 'gtk-3.lib'.
Someone has the same problem (see Error 3 error LNK1104: cannot open file 'gtk-3.lib'), but the solution is to use the all-in-one-bundle.
What shall I do? Have I followed the correct procedure or am I missing something? I've also tried to link to VS the *.a files located in the lib directory of mingw63 (e.g. libgtk-3.dll.a), but the linker error remains.
Best Regards and thank you for the attention
Davide
I am trying to compile the Win32 Example of the Parrot ARDrone SDK v1.8 using Visual Studio 2012 Express for Windows Desktop. I am running Windows 7 64-bit. The SDK is written in C, not C++.
I've managed to get through every error so far, but this one has me stumped.
When Run, I get these 3 messages in the Error List:
Warning 1 warning LNK4001: no object files specified; libraries used C:\Users\Netex\Desktop\ARDrone_SDK_Version_1_8_20110726\ARDrone_SDK_Version_1_8_20110726\Examples\Win32\VCProjects\ARDrone\Win32Client\LINK Win32Client
Error 2 error LNK2001: unresolved external symbol _mainCRTStartup C:\Users\Netex\Desktop\ARDrone_SDK_Version_1_8_20110726\ARDrone_SDK_Version_1_8_20110726\Examples\Win32\VCProjects\ARDrone\Win32Client\LINK Win32Client
Error 3 error LNK1120: 1 unresolved externals C:\Users\Netex\Desktop\ARDrone_SDK_Version_1_8_20110726\ARDrone_SDK_Version_1_8_20110726\Examples\Win32\VCProjects\ARDrone\Debug\Win32Client.exe Win32Client
I've tried many suggested solutions, including setting the SubSystem in Linker->System to "Not Set" and setting the entry point manually, which gets rid of the 2 errors and replaces it with:
`Error 2 error LNK1221: a subsystem can't be inferred and must be defined'
I've tried setting the Platform Toolset to v90 (which it was originally compiled in, I believe), which gets rid of the warning, but the errors persist.
QUESTION: What is causing these messages, and how can I fix it? Is it because I am trying to compile a Win32 console program on a 64-bit system?
Any help is much appreciated,
Dan
I'm using Qt VS Tools extension with Visual Studio 2019 and working in C++ on a Qt Gui Application created using the new project wizard. In my project properties under Configuration Properties | Linker | System, I have set SubSystem to "Console (/SUBSYSTEM:CONSOLE)" to cause a console window to come up alongside my GUI when debugging. This allows me to view outputs that I've added using qDebug like this:
qDebug() << "Testing";
What I have found is that if I perform a Build | Clean Solution and then Build | Build Solution, I get this error on the first build:
LNK2001 unresolved external symbol mainCRTStartup
Initially I was trying to figure out how to fix this (and ran across this post), but then I found that if I repeated Build | Build Solution the error goes away on subsequent builds, so my solution is to remember to build twice after a clean.
To see what would happen if I had never changed SubSystem to "Console (/SUBSYSTEM:CONSOLE)", I created a new Qt Gui Application project using the wizard. In this project SubSystem is set to "Windows (/SUBSYSTEM:WINDOWS)" as the default. Again I get the error on first build after a clean, but in this case it is a different unresolved symbol:
LNK2001 unresolved external symbol WinMainCRTStartup
Although I'm curious about the cause of the problem, the build twice solution is working for me for now.
in my case, the solution was to explicitly name the 'entry point', e.g. with the command line:
ml64 main.asm /subsystem:console /entry:main
the last option: '/entry:main' was crucial
A windows application I've been working on, is due to delivred without the use of CRT.
There's a few good articles descirbing the guidlines and benefits of doing so (none of which I could find upon writing this question - sorry) . Other then not using CRT symbols explicitly, it's all about linker and compailer configuration. My Release and Debug configurations are nearly identical now , and both specify /NODEFAULTLIB:"LIBCMT" only diffrence is the Run time flag /MT (in Release) vs. /MTd (in Debug) - that is required as I'm using __try/__except syntax for SEH, and so the only needed function is _except_handler3(). However, the Debug version is beeing built successfully, and the Release version fail with Unresolved Symbol _except_handler3 linkage error. When forcing Release version to compile with /MTd - this issue is solved.
How is that possible? which .lib contains the _except_handler3 export? and how can I solve this?
For an application without CRT see: http://blog.kalmbach-software.de/2008/02/02/smallest-application-size-for-win32-console-application/
But if you want to use __try / __except you need to use the CRT; or you need to write your own "_except_handler3".
See also: _except_handler3
Also you have the CRT source, and you can take a look into the source, to see what it is doing!
See: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src