I am trying to configure eclipse c++ to use SDL2.0.3.
1) I downloaded SDL
2)put `SDL2` folder with headers into `gcc\include` folder
3)I put libSDL2.a, libSDL2.dll.a, libSDL2.la, libSDL2_test.a, libSDL2main.a into gcc\lib folder
4) I put SDL2.dll into my current project's configuration DEBUG folder
5) I added in `project->properties->c/c++ build->settings->mingw c++ linker->libraries libSDL2main and libSDL2 (pic.)
But it shows me an error that it cannot find -llibSDL2main.
P.S I had issue once with winapifamily but I resolved it by putting winapifamily.h in gcc\include
Related
So i am new on the platform, i use c/c++ and i have interests in graph interfaces so i decided to use gtk+and gtkmm with visual studio.
First, i downloaded gtk for the gnome project. I followed all the steps and i got this after a manual run :
\\\ test23.cpp
#include <gtkmm.h>
int main(int argc, char* argv[])
{
Gtk::Main app(argc, argv);
Gtk::Window fenetre;
Gtk::Main::run(fenetre);
return 0;
}
$ g++ -std=c++ test23.cpp $(pkg-config gtkmm-3.0 --cflags --libs | sed 's/ -I/ -isystem /g')
Package gtkmm-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtkmm-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm-3.0' found
bash: g++: command not found
so i decided to install using vcpkg.
But I failed to install gtk+ and gtkmm after multiple tries.
Here what i've got :
C:\WINDOWS\system32>vcpkg install gtk
Computing installation plan...
The following packages will be built and installed:
gtk[core]:x86-windows
* harfbuzz[core,glib]:x86-windows
* libepoxy[core]:x86-windows
* pango[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x86-windows...
Starting package 1/4: libepoxy:x86-windows
Building package libepoxy[core]:x86-windows...
Could not locate cached archive: C:\Users\Manolo97233\AppData\Local\vcpkg\archives\f7\f743ec00b235ca7fd37812284b7d2e09d89b368a.zip
-- Using cached C:/Windows/SysWOW64/vcpkg/downloads/anholt-libepoxy-1.5.4.tar.gz
-- Cleaning sources at C:/Windows/SysWOW64/vcpkg/buildtrees/libepoxy/src/1.5.4-337c486045.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Windows/SysWOW64/vcpkg/downloads/anholt-libepoxy-1.5.4.tar.gz
-- Applying patch libepoxy-1.5.4_Add_call_convention_to_mock_function.patch
-- Using source at C:/Windows/SysWOW64/vcpkg/buildtrees/libepoxy/src/1.5.4-337c486045.clean
-- Acquiring MSYS Packages...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:72 (message):
Command failed: C:/Windows/SysWOW64/vcpkg/downloads/tools/msys2/msys64/usr/bin/bash.exe --noprofile --norc -c "pacman -S --noconfirm --needed pkg-config"
Working Directory: C:/Windows/SysWOW64/vcpkg/downloads/tools/msys2
Error code: 1
See logs for more information:
C:\Windows\SysWOW64\vcpkg\buildtrees\libepoxy\msys-pacman-x86-windows-err.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_acquire_msys.cmake:127 (vcpkg_execute_required_process)
scripts/cmake/vcpkg_configure_meson.cmake:106 (vcpkg_acquire_msys)
ports/libepoxy/portfile.cmake:16 (vcpkg_configure_meson)
scripts/ports.cmake:79 (include)
I believed i had a problem with msys2 so i tried to install it separately following an install kit unsuccessfully.
then i tried to run separately other packages involved with gtkmm like pango and i got this :
//vcpkg install pango
Computing installation plan...
error writing file: C:\Windows\SysWOW64\vcpkg\buildtrees\0.vcpkg_dep_info.cmake: The data is invalid.
Someone explained on a topic it could be an vcpkg accessibility problem for others packages. i modified the accessibility of vcpkg for other packages in my systWOW64'file parameters but it went unsuccessful.
I don't know if vcpkg is problem because i did not remove it and re install it.
I am looking for solutions/options, I am short on ideas, i literally need some help.
Thanks
Use JHbuild, its your friend when building GNOME applications from source !
Run jhbuild build gtkmm --nodeps, the built files will be installed in $HOME/jhbuild/build. To compile your application with it, you must export the environment variable PKG_CONFIG_PATH as follows:
export PKG_CONFIG_PATH="$HOME/jhbuild/build/lib/pkgconfig"
(in the terminal you are running the g++ command from)
And you have to install g++.
I do not know how you are using bash together with visual studio, but
if you have apt, you can install g++ and gtkmm with the following command :
apt install libgtkmm-3.0-dev libgstreamermm-1.0-dev g++
If you have already downloaded gtk, then the downloaded package must contain a .pc file. The directory this file is in when you installed the downloaded package you must add to the PKG_CONFIG_PATH.
Thanks Frederic for your answer it really help me.
I have got an other question. In my quest to add external packages to my C/C++ project, i read differents topics about how to convert static library (.a) into static library (.lib).
I downloaded packages and i wanted to add them manually using their pathway.
I added my packages as followed:
1 / Add the path of the headers in the compiler directories for the project:
-> Project / Properties menu
-> On the left tree, choose Configuration properties - C / C ++ - General
-> On the right table, the first line "Other Include directories": add the directory (s) of your library containing the headers
2 / Add the path of the .lib in the compiler directories for the project:
-> Project / Properties menu
-> On the left tree, choose Configuration Properties - Link Editor - General
-> On the right table, the line "Directory of additional libraries": add the directory (s) of your library containing the .libs
3 / Specify the libraries with which your project is linked:
-> Project / Properties menu
-> On the left tree, choose Configuration Properties - Link Editor - Enter
-> On the right table, the first line "Additional dependencies": add the .lib library (s) with which your project must be linked
But I looked for .lib files to add to my linker input instead, I found .a files and .dll files and I didn't know what to do. . a files and .lib files are almost identical. It seems like .a files are used under linux while .lib are used under windows.
I tried to add the .a files unsuccesfilly. I wondered if I could convert an .a file into a .lib file.
Thanks
last week I recieved my brand new Colibri VF61 with the Aster carrier board from Toradex.
I followed Toradex's guide on how to prepare the board to cross compile with qt here.
Everything from the tuturial went perfect, however I tried deploying my app and everything goes fine until I open the executable on my target device because I get the following message :
error while loading shared libraries: libQt5PrintSupport.so.5: cannot open shared object file: No such file or directory
I went to see if I had any Qt files in my target device at all, and there weren't so I went to my sysroot folder in my host device and I copied all the Qt files to my target device, (Qt5PrintSupport was there) but after I copied all the files in the exact same location as they where in my sysroot the same error keep appearing.
The files I copied were:
LibIcal Qt5Core Qt5OpenGLExtensions Qt5Svg
PulseAudio Qt5DBus Qt5Positioning Qt5SystemInfo
Qt5 Qt5Declarative Qt5PrintSupport Qt5Test
Qt53DCore Qt5Designer Qt5PublishSubscribe Qt5UiPlugin
Qt53DExtras Qt5Enginio Qt5Qml Qt5UiTools
Qt53DInput Qt5Gui Qt5Quick Qt5WebChannel
Qt53DLogic Qt5Help Qt5QuickTest Qt5WebKit
Qt53DQuick Qt5LinguistTools Qt5QuickWidgets Qt5WebKitWidgets
Qt53DQuickExtras Qt5Location Qt5Script Qt5WebSockets
Qt53DQuickInput Qt5Multimedia Qt5ScriptTools Qt5Widgets
Qt53DQuickRender Qt5MultimediaWidgets Qt5Sensors Qt5X11Extras
Qt53DRender Qt5Network Qt5SerialPort Qt5Xml
Qt5Bluetooth Qt5Nfc Qt5ServiceFramework Qt5XmlPatterns
Qt5Concurrent Qt5OpenGL Qt5Sql libxml2
Inside /usr/lib/cmake
and:
imports libexec mkspecs plugins qml
folders to /usr/lib/qt5
I have noticed that the problem may be that I dont have the "lib" folder inside /usr/lib/qt5 however I don't know how to create it since it wasn't in my sysroot.
Summing up: I want to execute my app by cross compiling but the lib folder is missing and I don't know how to create it or link it.
Having a library in the same path with the app using it doesn't necessarily mean that your app can find it. Follow one of the methods below;
Install the required qt libraries into system's standard lib directory(e.g. /usr/lib/)
Set environment variable LD_LIBRARY_PATH to where your qt libraries exist. Convention is generally having a bash script setting it then launching your app) or
At compile time, you set rpath variable to the location of qt libraries folder (-rpath for gcc)
i using quickfix c++
when i want store data to mysql db and using MySQLStoreFactory class(include with mysqlstore.h) it show top error
i also included mysql include path and libs but didn't change
so any Idea??
SOLVED!!
i downloaded new MYSQL server LIB
put library address additional library directory dependency for tradeclient project
change name of libmysql.lib to libMySQL.lib in mysql server folder
add libMySQ.lib name in linker ->input->additioanl dependency
put mysql include in C/C++ include directory
put "libmysql.dll" in release folder
build and run in cmd
and all Done !
I have a project with the following structure:
projectName-master/
data/
source/
thirdparty/ (here is placed FindSFML.cmake file)
.gitignore
CMakeLists.txt
README.md
SOURCES.md
TODO.md
I use CMake 2.8.11.1 (cmake-gui) to generate visual studio sln file. Paths are set this way:
where is the source code: E:/projectName-master
where to build the binaries: E:/projectName-master/source (1.Can I choose other directory or it should be set to the directory which contains source files: h, cpp etc. ?)
Next I choose: Configure -> "Specify the generator for this project = Visual Studio 11, Use default native compilers" -> Finish
Then I get an info: Error in configuration process, project files may be invalid
CMake Gui contains following informations:
Name: CMAKE_INSTALL_PREFIX Value C:/Program Files(x86)/projectName
Name: SFML_INCLUDE_DIR Value SFML_INCLUDE_DIR-NOTFOUND
CMake Error at thirdparty/FindSFML.cmake:165 (message):
Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
SFML_AUDIO_LIBRARY SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY)
Call Stack (most recent call first):
CMakeLists.txt:63 (find_package)
I downloaded SFML and set SFML_INCLUDE_DIR (in CMake Gui): C:/OpenGL/SFML-2.1/include/SFML but I still get that error. 2. How to fix that ? What about lib files and dll's ?
Edit1:
I downloaded SFML from the official site
FindSFML.cmake from the project doesn't contain any SFML_ROOT entry, but SFML_INCLUDE_DIR looks like this:
# find the SFML include directory
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
PATH_SUFFIXES include
PATHS
${SFMLDIR}
$ENV{SFMLDIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/)
So how to set SFML_ROOT ? Do I need to add some entries (records) to that file ? How it will look like ?
Edit2: A part of the new FindSFML.cmake with a path to SFML (C:/OpenGL/SFML-2.1/)
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
PATH_SUFFIXES include
PATHS
${SFML_ROOT}
$ENV{SFML_ROOT}
C:/OpenGL/SFML-2.1/
~/Library/Frameworks
/Library/Frameworks
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/)
First of all, SFML is not CMake standard module, so it would be nice to provide link to sources. I hope you mean this product. Take a look at the FindSFML file:
# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
# to tell CMake where SFML is.
So you probably simply need to set SFML_ROOT variable, but not SFML_INCLUDE_DIR.
What about lib files and dll's?
I think this may be helpful:
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
Can I choose other directory or it should be set to the directory which contains source files: h, cpp etc.
It is highly recommended to use a separate directory.
So, I have to ask very noobish question, but I have been scrambling all over the Internet and I can't seem to find the anwser.
So, I decided to use Boost with Code::Blocks. I used BoostPro Installer and installed the latest version, which is 1.51.0.
So, directory where my Boost folder is located is :
C:/Program files/boost
That directory also contains one folder within it, so it's like this :
C:/Program files/boost/boost_1_51
So, my question is, how do setup my Code::Blocks so it can work. I did the following :
Went to Settings > Global Variables, created a new one called boost.
Set it's base to : C:\Program Files\boost\boost_1_51
Set it's include to : C:\Program Files\boost\boost_1_51\boost
Then, I went to my project, right-clicked it > Build Options > highlighted my root project > Search Directories.
Then, under my Compiler sub-tab, I clicked Add and added this :
$(#boost.include)
Under Linker sub-tab, I clicked Add and added this :
$(#boost.lib)
And I can't seem to compile sample code (located on official Boost web-site > Getting started).
Thanks in advance!
The CodeBlocks wiki has instructions on setting up boost: http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef
In particular, for building boost from source, look at the Build Boost section and make sure to choose the correct toolset (in your case, I assume it would be --toolset=gcc when using MinGW).
In order to use Filesystem, I used another computer, and performed the following steps, and it worked:
1) Installed MinGW
2) Added this enviroment variable => C:\MinGW\bin
3) bootstrap.bat gcc
4) b2 install --prefix="C:\Boostbuild" --toolset=gcc
5) Added this enviroment variable => C:\Boostbuild\bin
6) b2 --build-dir="C:\Boostbuild" toolset=gcc --build-type=complete stage
7) Installed CodeBlocks without MinGW
CodeBlocks:
8) Settings->Global variables: current variable => boost, Base => C:\boost_1_53_0, include => C:\boost_1_53_0\stage\lib
9) On the new C++ console project:
Build Options->Choose Project Name on the left -> search directories
On compiler tab, press Add and type: $(#boost)
On linker tab, press Add and type: $(#boost.lib)
10) On the new C++ console project:
Build Options->Choose Project Name on the left -> linker settings
Add the following link libraries:
..\..\boost_1_53_0\stage\lib\libboost_filesystem-mgw46-mt-1_53.a
..\..\boost_1_53_0\stage\lib\libboost_system-mgw46-mt-1_53.a
Thanks everybody