how to use install library in c++ in visual studio code? - c

I want to use a library with c++ in visual studio code with in Mac. I installed scip and VScode but I can't use it.
when I run
1 error generated.
The terminal process terminated with exit code: 1
I am not familiar with c but I know how to use scip's function. So I need to compile scip in c. any help ?
I installed scip in download file. and I have c/c++ Microsoft for visual studio code

You are mixing up a few things here. Visual Studio Code cannot compile code - it's more like a fancy editor. You are probably referring to Microsoft Visual Studio 2017 or 2019. This is a fully-featured IDE that also comes with a C/C++ compiler.
To compile SCIP, I strongly recommend CMake. There are detailed instructions on how to do this in the SCIP docs.
Also keep in mind, that installation of SCIP is different from compiling it yourself. You need the sources and probably your self-built librarires/binaries to link SCIP to your own custom code. If you only want to use SCIP, then it's sufficient to run the installer and start it - no compilation whatsoever is necessary.

Related

installing GSL library for C programming in windows

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!).

Visual Studio Community 2017 cl linker won't link GTK3 libraries?

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.

GTK Linker Issue Visual Studio C Project

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

Using SDCC in Visual Studio 2010?

Is there a way to use the Visual Studio 2010 IDE with the Small Device C Compiler (SDCC)? I would like to compile using SDCC within Visual Studio.
If you want to go this route then you are going to have to figure a lot of things out for yourself. Here is how I would start:
Write a Makefile that builds your project with SDCC when you type "make", and cleans your project when you type "make clean", and rebuilds your project when you type "make clean all".
Do File -> New Project and select "Makefile project". Set the build, clean, and rebuild commands to the commands I said above.
You might have to move the .sln and .vcxproj files to the directory with your Makefile and source code so Visual Studio can find it.
At this point you should be able to build your project from inside Visual Studio.
Unfortunately, it looks like Visual Studio does not understand the format of the error messages produced by SDCC, so either you would have to reconfigure Visual Studio or recompile SDCC if you want that to work. I will leave that as an exercise for you.
I expect that Visual Studio will also trip over a lot of the SDCC keywords that it does not understand, such as "__code" so you might have to do something like this to hide those keywords from Visual Studio:
#ifndef SDCC
#define __code
#endif
Overall, I expect you to have a lot of trouble.
If you'd like to see some instructions for using SDCC with Eclipse instead, see the Wixel User's Guide.

The program can't start because MSVCR80D.dll

I have made a dll in Microsoft Visual Studio 2005. Then i am trying to use it in other project on the other computer in CodeBlocks IDE. Project is built, but when it use functions from dll i got an error: "The program can't start because MSVCR80D.dll is missing from your computer. Try reinstall the program to fix this problem". How to build my dll without dependences on MSVCR80D.dll or build in this MSVCR80D.dll?
You're trying to run a debug version, which is linked to the debug version of the CRT. The latter is only available where VS has been installed. You should use the release version of your project on other machines (or manually copy all the dependent debug DLLs, which is not legal according to the license...).

Resources