Updating Netbeans C++ Makefile - c++

I added some outside library files to my C++ project in netbeans within my Source folder. However the makefile doesnt seem to build them. I cant figure out how to add them to my makefile to have them included in the build. Has anyone done this before?
Thanks!

Did you add it as source files or as compiled library?
Source files: You need to add them to your Netbeans project (not only place them into the folder). Otherwise they aren't compiled when building it.
Compiled library: This typically needs two settings: Add the library to the linker (Build -> Linker -> Libraries) and add the libraries header path to the include path (Build -> C++ Compiler -> Include Directories)

Related

Adding external library (Gurobi) to Eclipse C++

I would like to use Gurobi in a C++ project I have in Eclipse. I tried multiple manuals/tutorials (including THIS on how to do the same in Visual Studio) to add the hook up the Gurobi files with Eclipse/GCC, but I just couldn't make it work. I feel like I don't understand enough how these things should work in the first place.
In my Gurobi folder I have 3 folders, that in my opinion are important: include (with .h files), lib (with .lib files and NO .so or .a files) and src (with .cpp & .h files).
include: I added the path to this folder to C/C++ Build -> Settings -> GCC C++ Compiler -> Includes -> Include paths, I guess this is for the compiler to see the .h files. I also added it to C/C++ General -> Paths and Symbols -> Includes -> Include directories, I guess this is for the linker to see the .h files.
lib: I first added the folder path to C/C++ Build -> Settings -> MinGW C++ Linker -> Libraries -> Libraries (-l), however after searching online it seems to me this option only works for libraries with standard names and extensions. It also gave me the error ld.exe: cannot find -lc:/gurobi900/win64/lib/, so I deleted it and added the two .lib file paths separately to Miscellanous -> Other objects.
I got to the point where #include "gurobi_c++.h" works, however, already Eclipse underlines a line where I am defining a GRBEnv() object, that is declared in include/gurobi_c++.h, but defined in src/cpp/Env.cpp. Also if I try to compile, I get undefined reference errors. This means neither the Linker nor the Compiler can see the definition of GRBEnv().
Is there a way to tell the linker/compiler where the .cpp files are? Is it happening automatically, based on the path of the include folder? Am I supposed to link the .lib or the .cpp files?
I would greatly appreciate even if someone just pointed out mistakes in my understanding.

Configuring a Gurobi C++ project using Eclipse? [duplicate]

I would like to use Gurobi in a C++ project I have in Eclipse. I tried multiple manuals/tutorials (including THIS on how to do the same in Visual Studio) to add the hook up the Gurobi files with Eclipse/GCC, but I just couldn't make it work. I feel like I don't understand enough how these things should work in the first place.
In my Gurobi folder I have 3 folders, that in my opinion are important: include (with .h files), lib (with .lib files and NO .so or .a files) and src (with .cpp & .h files).
include: I added the path to this folder to C/C++ Build -> Settings -> GCC C++ Compiler -> Includes -> Include paths, I guess this is for the compiler to see the .h files. I also added it to C/C++ General -> Paths and Symbols -> Includes -> Include directories, I guess this is for the linker to see the .h files.
lib: I first added the folder path to C/C++ Build -> Settings -> MinGW C++ Linker -> Libraries -> Libraries (-l), however after searching online it seems to me this option only works for libraries with standard names and extensions. It also gave me the error ld.exe: cannot find -lc:/gurobi900/win64/lib/, so I deleted it and added the two .lib file paths separately to Miscellanous -> Other objects.
I got to the point where #include "gurobi_c++.h" works, however, already Eclipse underlines a line where I am defining a GRBEnv() object, that is declared in include/gurobi_c++.h, but defined in src/cpp/Env.cpp. Also if I try to compile, I get undefined reference errors. This means neither the Linker nor the Compiler can see the definition of GRBEnv().
Is there a way to tell the linker/compiler where the .cpp files are? Is it happening automatically, based on the path of the include folder? Am I supposed to link the .lib or the .cpp files?
I would greatly appreciate even if someone just pointed out mistakes in my understanding.

whats means "Link executables with xxx.lib"

I have one guide integrating software files to my program on c++. Steps are:
-Add /Resources/xxx-io/include/ directory to your project include directories settings
-Add /Resources/xxx-io/lib/ directory to your project library directories settings
-Include xxx.h in your software code
Link executables with xxx.lib
What dose the last one mean? I'm building simple win console program with visual studio 2015 c++ that communicates with software. I have linked the lib and includes and included header, but that last one is mystery.
To say simply, it means that you should go to Project properities -> Linker -> Input and add there library, to which you want your executable to link to.
If you want to learn what does it actually mean, read some articles on how .libs work. To say shortly, .lib library is compiled code, that is inserted into your program.

Adding openCV .dll files to Netbeans C++ Qt application

I am developing software where I need to use the OpenCV libraries under NetBeans. Took 2 days to be able to run correctly a C++ Application with OpenCV.
In a C++ Application I needed to add C:/OpenCV245/build/include in project properties->Build->C++ compiler-> Include Directories and Headers. Also, Under the Linker properties-> Additional Library Directories I had to add the following directories
C:/OpenCV245/release/lib
C:/OpenCV245/build/x64/mingw/lib
and add the .dll files I specifically needed in the linker->libraries
Now when I try to create a C++ Qt application, I add the proper include directories and headers but I can't add the path to my "additional libraries"...
I tried building to see what errors would pop:
cannot find -lopencv_core245.dll
cannot find -lopencv_highgui245.dll
How do we add .dll.a files to a C++ Qt application under Netbeans?
Programming environment:
NetBeans 7.4
MinGW 3.2 Compiler c++ compiler, msys make command and qt5.1.1 qmake for Qmake Command
Qt5.1.1
OpenCV2.4.5
Windows 8 64 bit
It appears as if you are trying to link with the *.DLL files instead of *.LIB files. The right way to go is to:
In the linker->libraries settings link to the *.LIB files you need instead of the *.DLL files.
Compile your program so you get an *.EXE
Put the relevant *.DLL-files in the same folder as the *.EXE
The program is now runnable if you double-click its icon in the file browser.
It the program refuses to run from Netbeans but it works from the file browser, then that is because you need to tell Netbeans what the "current working directory" is when you launch the program in debug mode. This setting should be available in some settings dialog.
+Under Project Properties-> Build -> Qt go to Expert Custom Definitions add add the path to the appropriate .dll.a files with the LIBS +=
+Under Project Properties-> Build -> C++ Compiler in Include Directories and Headers add the appropriate path for the includes. ex: C:\OpenCV\build\include
+Under Project Properties-> Build -> Linker click on Libraries then Add Library File... ( NOT ADD LIBRARY) and add the appropriate .dll.a files that were included in the first point.

Add library to C/c++ eclipse indigo project

I am trying to add a library to C/C++ project in Eclipse by the following procedure:
Properties->C/C++General->includes (within includes specifying the folder in which the library is kept).
Properties->C/C++General->Library Paths (Specifying the library paths of .so and .a files)
Properties->C/C++General->Libraries (Specifying adding paths of .so and .a files)
But when I build the project,it is not able to find the path of header files that I am including in my project.
Can someone please tell me where the error is?
A similar question was posted here. You need to add the libraries in the Properties -> C/C++ -> Build area, not the General area.
Hope this helps.