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
Related
I want to install the GSL library (https://www.gnu.org/software/gsl/) in windows. I have downloaded the files but i do not know what to do apart from that in order to be able to use the functions of the library (apart from the #include <...> in my program.c file).
I am using visual studio code and i have installed mingw.
Thanks in advance
EDIT
I am adding more information about this issue. I am not the original poster, but I have the same problem.
I am trying to use the GSL and I work with Visual Studio Code on Windows 10.
I have already installed the basic packages to work with C/C++ in
Visual Studio Code. More precisely, if I am not wrong, VS Code is
using the compiler gcc.exe from mingw64 (last version). This was
installed using an 'extension' available at VS Code (https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
I downloaded the last version of the GSL (2.7) and unzipped it.
I get stuck when I try to follow the installation instructions. When I
execute either .\configure or ./configure in the DOS command line,
I get an error of "unknown command" (even if I am placed in the same directory where the file is stored).
When I execute .\configure in PowerShell, I get a message asking me
which programme should be used to open this file.
And here is where I get lost. :/
I have discovered an alternate path, which is installing GSL from vcpkg (https://vcpkg.io/). This is suggested by VS Code, actually. This vcpkg seems to be a programme by Microsoft to make it easier to install third-party C/C++ packages in Windows.
The specifications to install vcpkg are (https://vcpkg.io/en/getting-started.html):
Windows 7 or newer
Git
Visual Studio 2015 Update 3 or newer
I can try this path, but first I would like to be sure there is no easier way (installing Visual Studio to not really use it seems a lot to me!).
I heard that Nuget builds project easier without any configuration.
So, I am trying to add pthreads in my project from Nuget
(Actually I am using windows 10 x64 Visual studio 2017, C language, and my friends use linux OS)
I just search pthreads in Nuget package, click "install" button
But, my project compiles well but fatal error LNK1120 called.
Is there any more configuration after install pthreads from nuget?
The reason why I ask this simple question in stackoverflow is that, there is no more steps in Microsoft official guides.
Is there any more configuration after install pthreads from nuget?
Using Nuget format to install pthread into C++ projects is quite simple and will not manually configure include Directories and additional Dependencies address any more.
But pthread nuget package in VS has a drawback that it does not fully inherit pthread class library. It lost a file called pthreadvc2.lib. You can try my following suggestions to configure it without any settings in project properties.
Solution
1) download pthread-w32-2-9-1-release.zip from this link.
2) unpack this file and then copy pthreadVC2.lib from the file(pthreads-w32-2-9-1-release\Pre-built.2\lib\x86 or x64) into
C:\Program Files (x86)\Microsoft Visual Studio\2017\xxxxx\VC\Tools\MSVC\xxxx.xx.xxxx\lib\x86 or x64.
Note that you should copy the related lib into the related folder, x86 pthreadVC2.lib into x86 folder, x64 pthreadVC2.lib into x64 folder.
3) then add this into your cpp file:
#pragma comment(lib,"pthreadVC2.lib")
Then it will work as expected without any errors.
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.
I downloaded and installed evaluation software of:
Intel Parallel Studio XE Professional Edition for Fortran Windows. My system is a 64 bit, Windows 7 OS. During its installation I was asked to download and install also: Microsoft Visual C++ 2013 Redistributable(x64)- 12.0.21005 .
I am trying to compile my source files using the command line.
In order for the command ifort to be recognized, I added the directory:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin\intel64
to the PATH environment variable . (This folder contains the file ifort.exe).
However, when I try to compile a simple 'Hello World' program by the command:
ifort hello.for
I get the error:
ifort: error #10037: could not find 'link'
The file 'hello.obj' , however, was created.
The steps I tried in order to fix this error (but that made no difference):
1) I tried to add to the PATH environment variable the directory:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin\intel64_gfx
This folder contains the file: gfx_linker.exe, which I thought is the needed linker.
2) I tried to change the configuration of Visual Studio to add 64-bit support, according to the 4 steps Steve Lionel (Intel) sugested in (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/300121), but the window that appeared (after pressing the change option in the 'Uninstall or change a program utility' of the control panel) showed no 'x64 compiler&tools' checkbox option, only a repair button option, which made no difference.
3) I tried to update the ifort installation, as Tim Prince suggested in (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/280266). I tried to do it through the 'Uninstall or change a program utility' in the control panel. But selecting the 'Repair' option in the window that appeared blocked the completion of the process by stating that 'repair cannot be done because no available sources were found', and selecting the 'Modify' option, blocked me in the step of 'selecting components to modify' (nothing I chose enabled the 'next' button).
4) Before calling ifort I tried to execute the cammand:
"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bincompilervars.bat" intel64 vs2013
as Steve Lionel (Intel) suggested in the previous link, but got the error:
ERROR: Visual Studio 2013 is not found in the system.
Right now I'm out of options, and beg for help to show me how to fix this error of ifort not being able to find the 'link'.
You can simply compile your Fortran files from command line using ifort, to do that:
Start menu > programs > Intel parallel studio XE 2O16 > Intel 64 visual studio mode or search for Intel 64 in the start menu
open Intel 64 visual studio mode . Now you can start to use ifort and it will work fine.
If you want to know how to invoke it (the parameters used) then right click over Intel 64 visual mode, from the menu choose open file location.
I uploaded these screenshots, just take a look:
From the second screenshot notice the parameters passed to the batch file.
Note: according to Intel documentation the second argument (vs2013) is optional.
My friend got the same problem. Here was what I advise him to do and it worked. The reason why this happened is that you missed link.exe located in C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\ and other related folders too. So, you can use a small software called everything to search your computer to find out whether the link.exe is missing in your Microsoft Visual Studio folder. If it is the case, you can copy these files from someone else or just reinstall your visual studio and make sure everything is right in place.
I had the same issue.
First of all add "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\bin" to path.
Now, from windows command line run: compilervars.bat intel64
It sets up the environment on the windows command line.
now you can access the "ifort" commands without getting the linking errors.
I'm going to start by pointing out the required steps needed for code to metamorphose into executables: [SO]: LNK2005 Error in CLR Windows Form (#CristiFati's answer). That's for C, for Fortran it's the same thing, except:
Step #1. does not exist (at least, I don't think so)
Step #2. will be performed (obviously) by the Fortran compiler
Ran into the same issue when working on [SO]: What is numpy.ctypeslib.as_ctypes exacty doing (#CristiFati's answer). Environment:
Intel's oneAPI HPC Toolkit (also Base - which is a direct dependency) for ifort.exe
Microsoft's Visual Studio (I have many versions installed, chosen v2019 as it was the newest at the time) for link.exe
As seen (one has to look in both Output snippets) I built it manually in 2 steps.
But ifort.exe can automatically invoke link.exe, if the latter's dir is in the PATH variable. For more details on invoking VStudio commands, check [MS.Learn]: Building on the Command Line.
Hello I'm getting into Winsock programming in C. I believe that in order for me to access the (or any other header related to Winsock for that matter) header file I have to have Visual C++ 2010 installed and set it as my default compiler. So I download it, and in CodeBlocks I set it to my compiler. I run some Winsock code and I get this message:
C:\Users\Jared\Documents\Test.c|6|fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory|
I also get this message for including 'winsock.h' and 'windows.h'. This has something to do with the Visual C++ compiler. I try installing Visual C++ 2008 and use it as my compiler and get the same message. I then read that I have to install microsoft's SDK. I download and install it and it gets an error saying that I can't install it (this is the .Net framework 4.0 version). I then try the 3.5 version and it installs fine but my compiler still can't find the header files. I have the .net framework 4.0 so I don't see the problem. I also read that I have to include some header files in Visual C++ by going to Tools>Options>Projects and Solutions>VC++ Directories and I get the following message:
"VC++ Directory editing in tools > options has been deprecated."
Visual C++ 2010 no longer supports this feature. Does anyone have a solution or can help me with this?
Long story short: I cannot include 'winsock.h', 'winsock2.h', or 'windows.h' using the Visual C++ 2010 compiler.
All help is appreciated.
In Visual C++ 2010 it is recommended to use property sheets instead of this kind of global directory settings editing. You need to edit the user settings property sheet (probably Microsoft.Cpp.Win32.user.props) in your AppData folder. You can do it in the UI through the Property Manager via View->Property Manager and browsing for that sheet.
However, I think you should have $(WindowsSdkDir)include in Include Directories if you have it installed correctly.