I have code::blocks and a spare evening, would like to put my hands on vulkan. Now on windows 7.
I'm having troubles finding any documentation/tutorials nor the libraries to work in codeblocks. I have glfw 3.2 but it requires a vulkan library and headers as well to work with it (#define GLFW_INCLUDE_VULKAN) otherwise it rightfully complains about a missing vulkan/vulkan.h. Also installed LunarG, but can't find any recognizable libraries in the package that i could link via the linker settings in the usual way.
My code right now is straightforward:
...
#include <GL/glu.h>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
int main(int argc, char **argv) {
glfwInit();
return glfwVulkanSupported();
}
with -lglu32 -lglfw3 -lopengl32 -lgdi32
Basically all i think i need is a library to link to but can't find any on the web.
Using the old GLU library may not be a good idea with Vulkan
Instal the LunarG SDK.
Set additional include directory in your IDE project: $VULKAN_SDK/Include (VULKAN_SDK is an env variable with a path to root of the SDK).
Do not link against OpenGL if you are only going to use Vulkan.
Code::Blocks is g++ or clang based right? Link against the vulkan-1.dll. -lvulkan-1 should suffice, because the path should be in PATH. Otherwise provide the path with -L — it is in $WINDIR/System32 (for x64 and x32 OS) and in $WINDIR/SysWOW64 (for x32 app on x64 OS).
vulkan-1.dll is installed there by drivers and by the SDK also.
Related
I have a C program written on linux that I would like to be able to run and develop on window. The program has a few external dependencies on posix/linux libraries so I'm guessing I would need to somehow compile those libraries under windows too. I'm quite new to the linux workflow, and no expert in C and it's compiler make up either. I know something like cygwin and/or msys2 and/or mingw-w64 might be what I need but I'm not really sure how to get it working in a way that would make sense for me.
My program looks like this (only relevant parts shown), and currently runs under my ubuntu linux VM:
// Build:
// gcc -o disc-identifier main.c `pkg-config --cflags --libs glib-2.0 libmirage libisofs-1`
//
// Run:
// disc-identifier test_image.nrg
#include <glib.h>
#include <mirage/mirage.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include <libisofs.h>
...
int main (int argc, char **argv)
{
...
}
My ideal goal is to be able to have this as a visual studio project that I can add to a solution and to be able to link the required dependencies (and compile) from within visual studio. I then want it to compile into a portable 32-bit x86 application (maybe with a few accompanying dll files), no bigger than a few MB. But from my understanding I would first need windows compatible versions of the used libraries (glib, libmirage, libisofs), which is where I am a bit lost as to how I would go about this.
I'm really not an expert of cross-platform development but I already build a cross-platform game (made with Irrlicht) mostly developped on Linux.
Have you heard or maybe already build your project with CMake ?
If not, I really invite you to check this very powerfull tool that CMake is.
Without entering in the details, CMake is a tool for cross-platform development that take care of many things and deliver to you ready-to-use build solutions, including for examples: Makefiles and Visual Studio solution files.
With little setups, you should be able to generate a .sln file for Visual Studio already ready to build your project for you (or require additional setups such as paths or DLL).
Sorry in advance if I misunderstand you question or if I'm not thorough technically.
Please let me know if you want for me to expand my answer ;)
Yes, you are right - if the libraries are not "header-only" you need a platform specific build. But this is really easy right now. For this purpose I can recommend vcpkg.
It supports msbuild and cmake integration - really nice.
To install for example glib you only need to open a cmd in your vcpkg folder and enter
vcpkg install glib
Visual studio supports both "msbuild" and "cmake" very well. Another option is to add dependencies via "NuGet" directly in Visual Studio.
If you use those tools, you don't need to compile the libraries yourself.
But what you have to check is if all your libraries support Windows. If not you can develop with Visual Studio and need to debug with "Remote Debugging". The easiest way is to use Windows Subsystem For Linux (WSL).
I am trying from past 4 days to get Zeromq working on my Windows machine but nothings seems to go my way.
I followed given steps and solved few dependcy issues.
I have build libzmq,czmq,libsodium successfully.
I used cmake 3.12 to configure and VS2015 SDK 8.1 to build solution.
I was able to run czmq_selftest.exe however it failed for few things and thats different issue.
But when I try to run basic program myapp.c
#include <czmq.h>
int main (void) {
zsock_t *publisher = zsock_new (ZMQ_PUB);
zsock_set_curve_server (publisher, true);
puts ("Hello, Curve!");
zsock_destroy(&publisher);
return 0;
}
I see this missing library issue , I tried given link method-
gcc myapp.c -o myapp -lczmq -lzmq
But nothing is working it would be really helpful if someone can provide some solution.
Here is other info -
OS - Windows 10
Cmake - 3.13.2
Visual Studio 2015, SDK 8.1
libzmq 4.3.0
czmq 4.1.1
Source: https://github.com/zeromq/czmq
More information-
My system-
C:\Users\P\go\src\github.com\zeromq\czmq\include
contains all the libraries.
My program is in -
C:\Users\P\go\src\github.com\zeromq\czmq\examples\security
Thanks
The compiler can't keep track of all libraries that a user might have installed on a system by itself. You have to tell the compiler where it can find things like header files or linker-libraries.
To tell the compiler to add a path to the list it uses for searching for header file, use the -I (upper-case i) option.
To tell the linker to add a path to the list it uses to search for linker-libraries use the -L option.
Considering the paths you mention in your question and comments you need to add both -I../../include and -L../../Debug.
That is, your complete command should look something like
gcc myapp.c -o myapp -I../../include -L../../Debug -lczmq -lzmq
Of course, that requires your to be in the directory C:\Users\P\go\src\github.com\zeromq\czmq\examples\security as you say.
I am trying to use regex in a c program. i am using windows 10 and Dev-C++ . whenever i add header file for regex i.e.
#include <regex.h>
it gives me error
[error] regex.h: NO such file or directory.
i couldn't figure out how to download and install regex library for c in dev-c++. compiler: TDM-GCC 4.9.2 64-bit Release. Thanks for your help.
I assume there something wrong with the include path during the compilation process. There is a nice expanation of the compilation process of c/c++ applications over here, in case you're interested.
Basically, when compiling a c/c++ application, your compiler, in a first step, scans your source files and replaces all #include <file.h> with the content of file.h it finds in its search path.
Dev-c++ uses MinGW and a port of the GNU compiler collection (gcc) for the compilation process.
Now what you have to do:
Figure out whether regex.h is included in your MinGW installation (Check /usr/include.)
Adapt the include path in dev-c++
Sadly I don't have a computer running Windows nearby making it hard to help with these two steps. To install regex on MinGW this package seems promising.
I can currently compile C programs with stdio.h and such like for Windows with the command i586-mingw32msvc-gcc, however I cannot do this for a GLUT program. When compiling it for Linux I use:
gcc main.c -lglut -lGLU
(I know, bad practice as it comes out with a.out)
Yet I am unsure of how I could do it for Windows using mingw32. When I run
i586-mingw32msvc -lglut -lGLU
it returns:
test.c:3:21: error: GL/glut.h: No such file or directory
The included header files are:
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
And I am unsure of how to make it able to compile. Any ideas?
Essentially that error tells you, that your MinGW GCC does not find the required headers. That is, because you're cross-compiling to another OS, and header files may contain OS specific things. Unfortunately OpenGL is one of those. So you have to install the required libraries in a Windows version as well.
However you should not just download some precompiled binaries from the web; you need libraries matching MinGW. You can of course install MinGW built libraries, that will work. However I suggest something different: Crosscompile and locally install all the libraries you require in your MinGW environment yourself. You do this, by passing the right compiler, linker and prefixes into the build configuration of each library. For example for autoconf based configure (on my system)
CC=i686-mingw32-gcc CXX=i686-mingw32-g++ ./configure --prefix=/usr/i686-mingw
make ; make install will then build and install the libraries and their headers in the MinGW environment, where you can use them as any other regular installed library.
I'm a complete beginner to Apple's Xcode, but I have followed the Xcode documentation and the advice of a few related questions without success.
I installed GMP to /usr/local/bin, wrote a short program using the library, and compiled with gcc main.c -lgmp. It compiled with no warnings or errors, and the executable worked flawlessly.
I started a new Xcode project (Command Line Tool; Type: C), copied the code to the newly created main.c, and opened the project build settings. From there I set Linking > Other Linker Flags to -lgmp and Search Paths > Library Search Paths to /usr/local/bin. However, the build fails with the preprocessor error "Gmp.h: No such file or directory".
I have tried almost every header imaginable:
#include "gmp.h"
#include <gmp.h>
#include "gmp"
#include "libgmp.a" . . .
This has been my main obstacle over the last three months which has prevented me from learning C. Any help leading me to an eventual solution would be greatly appreciated.
There's a few things you have to set up in your Xcode project. For example, I have gmp installed in /opt/gmp/5.0.2 and I will use that as an example. The actual library is installed into /opt/gmp/5.0.2/lib and the header files into /opt/gmp/5.0.2/include. When installing the library setting the --PREFIX flag to /opt/gmp/5.0.2 would handle this automatically. If you don't set this flag the prefix is usually set to /usr/local by default.
The Other Linker Flags looks right, it should be the name of the library.
Set the Header Search Path to the include directory, in my case /opt/gmp/5.0.2/include.
Set the Library Search Path to the lib directory, in my case /opt/gmp/5.0.2/lib.
Since the header search path has been set, you should now be able to include the header file like this:
#include <gmp.h>
Of course, replace /opt/gmp/5.0.2 with the PREFIX path you used when you installed gmp.
Lastly, you typically don't install libraries to /usr/local/bin, you would install to /usr/localand let any binaries be installed into bin while libraries like these would be installed into lib. Of course any path scheme would work, I usually recommend /opt/<project-name>/<version-number> since it allows me to keep better track of what I have installed and have multiple versions of the same libraries and tools without having to deal with collisions.
I have updated my system from snow leopard to mountain lion and had to install gmp.
First of all I have installed Xcode CommandLineTools set.
Secondly, installed Homebrew. Then with it I have done steps in this topic: https://apple.stackexchange.com/questions/38222/how-do-i-install-gcc-via-homebrew
In my last step, made changes to an xcode project as colleague Marcus Karlsson told.
It's finally working! Very big Thank You :)