trying to translate this documentation https://vulkan-tutorial.com/Development_environment for getting visual studio ready to compile vulkan code to work with VS Code.
so far VS Code generates this g++ commandline (without the line breaks):
C:\Users\MYUSER\development\vulkan\MSYS2\mingw64\bin\g++.exe -fdiagnostics-color=always -g
C:\Users\MYUSER\development\vulkan\code\vulkantest.cpp -o
C:\Users\MYUSER\development\vulkan\code\vulkantest.exe
-I C:\Users\MYUSER\development\vulkan\glfw-3.3.7.bin.WIN64\include
-I C:\Users\MYUSER\development\vulkan\glm-0.9.9.8\
-I C:\Users\MYUSER\development\vulkan\vulkan_sdk-1.3.204.1\Include\
-L C:\Users\MYUSER\development\vulkan\vulkan_sdk-1.3.204.1\Lib
-L C:\Users\MYUSER\development\vulkan\glfw-3.3.7.bin.WIN64\lib-vc2022
now in the screenshots from the link above they "add" glfw3.lib and vulkan1.lib, adding just glfw3.lib like this does not work:
C:\Users\MYUSER\development\vulkan\MSYS2\mingw64\bin\g++.exe -fdiagnostics-color=always -g C:\Users\MYUSER\development\vulkan\code\vulkantest.cpp -o C:\Users\MYUSER\development\vulkan\code\vulkantest.exe -I C:\Users\MYUSER\development\vulkan\glfw-3.3.7.bin.WIN64\include -I C:\Users\MYUSER\development\vulkan\glm-0.9.9.8\ -I C:\Users\MYUSER\development\vulkan\vulkan_sdk-1.3.204.1\Include\ -L C:\Users\MYUSER\development\vulkan\vulkan_sdk-1.3.204.1\Lib -L C:\Users\MYUSER\development\vulkan\glfw-3.3.7.bin.WIN64\lib-vc2022 -lglfw3.lib C:/Users/MYUSER/development/vulkan/MSYS2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglfw3.lib: No such file or directory collect2.exe: error: ld returned 1 exit status
this file:
"C:\Users\MYUSER\development\vulkan\glfw-3.3.7.bin.WIN64\lib-vc2022\glfw3.dll"
does exist.
how do you add that library in windows/VS Code?
Related
I want to compile a C source file from command prompt that draws a triangle using openGL. I have the gcc compiler installed. The source file that I want to compile and execute is binded with something called Makefile.win32 file.
In my computer's F: drive there is a folder called opengl_codes. Inside that folder there are a bunch of files and two folders called hello_triangle and common.
Inside the hello_triangle folder I have these files : main.c and Makefile.win32.
I read a bunch of tutorials in the internet about Makefile, found out that to compile and execute the c source file I have to do this :-
1.first execute make -f Makefile.win32 in command prompt from the containing directory.
2.then compile the source file. i.e. gcc -o main.exe main.c
But when I execute the first command i.e. make -f Makefile.win32I get this error :-
gcc -Wall -pedantic -o hellot.exe main.c -I ../common/include ../common/win32/libglew32.dll.a ../common/win32/glfw3dll.a -lOpenGL32 -L ./ -lglew32 -lglfw3 -lm
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglew32
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglfw3
collect2.exe: error: ld returned 1 exit status
make: *** [all] Error 1
I am not understanding what is causing this error.
Makefile :-
BIN = hellot.exe
CC = gcc
FLAGS = -Wall -pedantic
INC = -I ../common/include
LOC_LIB = ../common/win32/libglew32.dll.a ../common/win32/glfw3dll.a
SYS_LIB = -lOpenGL32 -L ./ -lglew32 -lglfw3 -lm
SRC = main.c
all:
${CC} ${FLAGS} -o ${BIN} ${SRC} ${INC} ${LOC_LIB} ${SYS_LIB}
I can easily compile my file Banco.cpp with the following commands, but I can't do with in Eclipse:
In Prompt:
C:\Users\Jonathas\workspace\Banco\src>g++ -I "C:\Program Files\PostgreSQL\9.4\include" -L "C:\Program Files\PostgreSQL\9.4\lib" -lpq -o Banco Banco.cpp
I'm going to:
Project>Properties>C/C++ Build>Settings>GCC C++ Compiler>Miscellaneous>Other flags>
and type:
-I "C:\Program Files\PostgreSQL\9.4\include"
-L "C:\ProgramFiles\PostgreSQL\9.4\lib" -lpq
But this doesn't work.
Error:
g++ -O2 -g -Wall -I "C:\Program Files\PostgreSQL\9.4\include" -L "C:\ProgramFiles\PostgreSQL\9.4\lib" -lpq -o "src\Banco.o" "..\src\Banco.cpp" c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpq collect2.exe: error: ld returned 1 exit status
I just want compile it in Eclipse...
I am compiling a C++ application using GNU g++. The project takes advantage of OpenSSL libraries.
Background
On my machine (a 64 bit CentOS quad core) I compile and link my files.
g++ -g -c -L/usr/local/lib/ -L/usr/lib64/
-I/usr/local/include/ -I/usr/local/ssl/include/
-lcrypto mysrc1.cpp mysrc2.cpp mysrc3.cpp
g++ -L/usr/local/lib/ -L/usr/lib64/ -lcrypto
*.o -o ./myapp.out
My application uses function MD5 which is contained in libcrypto.so. As you can see I specify to g++ the dirs where to search using the -L, -I options and which libraries to look for with the -l<lib-name> option. There are some trivial paths like /usr/local/lib which can be omitted of course, but I specified them because the makefile is parametric.
The problem
My problem is that I can successfully compile my stuff (first command), but linking fails (second command):
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status
make: * [cppsims_par] Error 1
But I did check folders and everything... libcrypto.so is inside /usr/lib64/. What is going on?
It may help if you try strace to find why it failed the file lookup
strace -f -e trace=file g++ -L/usr/local/lib/ -L/usr/lib64/ -lcrypto
*.o -o ./myapp.out
I did find the problem and it is related to this question: ld cannot find an existing library
Actually I had no symlink libcrypto.so and the compiler was not able to find the library...
I had related issue, and resolved it after inspecting the trace.
I had
-L<my/path/to/lib> -llib_some_library
when it should have been
-L<my/path/to/lib> -lsome_library
I am trying to build some software on a brand new install of CentOS 5.5
My compile line is :
g++ -I ../common/ -I ../readers/ -I ../writers/ -I /home/dcole/software/xerces-c-3.1.1/src -O3 -Wall -fopenmp -fPIC -o chipper chipper.cpp -L/usr/lib64/ ../../lib/IDT.a ../../lib/Linux/libxerces-c.a -lcurl -lidn -ldl -lssl ../../lib/Linux/libfftw3f.a -lpthread -lm
and I am getting
[exec] /usr/bin/ld: cannot find -lcurl
[exec] collect2: ld returned 1 exit status
Even though I can actually see the lib
$ /sbin/ldconfig -p | grep curl
libcurl.so.3 (libc6,x86-64) => /usr/lib64/libcurl.so.3
libcurl.so.3 (libc6) => /usr/lib/libcurl.so.3
So why cant g++ see it?
At link time, -lcurl tells the linker to look for libcurl.so.
From there, the SONAME within the library (libcurl.so.3) is embedded into the executable, and that's the filename that is searched for when executing.
You have libcurl.so.3 but may be lacking libcurl.so, which is needed for development.
What is your distribution? Usually there will be a second package with development headers/libraries, separate from the runtime bits.
Copy the file from any source /usr/lib/libcurl.so and place it in /usr/lib/, then try to compile. It will work out.
I'm trying to use the Boost Libraries ... but to no avail. I attempted to follow the Getting Started tutorial on Boost's website (for Unix Variants), but having problems along the way.
I compiled the libraries into a directory in my Downloads folder:
/Users/myUsername/Downloads/boostCompiled
When I use the full path to the library ... The example program (given on the Boost Website) compiles and links fine.
g++ -o boostTesting boostTesting.cpp -I /Users/myUsername/Downloads/boostCompiled/include/ /Users/myUsername/Downloads/boostCompiled/lib/libboost_regex.a
However, when I attempt to link the using the -L and -l options ... it fails ...
g++ -o boostTesting boostTesting.cpp -I /Users/myUsername/Downloads/boostCompiled/include/ -L /Users/myUsername/Downloads/boostCompiled/lib/ -l boost_regex
ld: library not found for -lboost_regex
collect2: ld returned 1 exit status
g++ -o boostTesting boostTesting.cpp -I /Users/myUsername/Downloads/boostCompiled/include/ -L /Users/myUsername/Downloads/boostCompiled/lib/ -l libboost_regex
ld: library not found for -llibboost_regex
collect2: ld returned 1 exit status
g++ -o boostTesting boostTesting.cpp -I /Users/myUsername/Downloads/boostCompiled/include/ -L /Users/myUsername/Downloads/boostCompiled/lib/ -l regex
ld: library not found for -lregex
collect2: ld returned 1 exit status
My shell is bash ... and I've set my DYLD_LIBRARY_PATH to the following:
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/Users/myUsername/Downloads/boostCompiled/lib
It appears I'm not using the correct name to link (with the -l) option. Can somebody please help! Thanks in advance!
There shouldn't be a space between -L and /Users/myUsername/Downloads/boostCompiled/lib/
Make sure that libboost_regex.a is compiled in /Users/myUsername/Downloads/boostCompiled/lib.
Then this should work:
g++ -o boostTesting boostTesting.cpp -I/Users/myUsername/Downloads/boostCompiled/include/ -L/Users/myUsername/Downloads/boostCompiled/lib/ -lboost_regex