Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How to include files .h or .cpp as external library? (How to include files .h or .cpp as external library?)
Re: How to include files .h or .cpp as external library? [message #52696 is a reply to message #52682] Tue, 12 November 2019 16:22 Go to previous messageGo to previous message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Hello Fasasoftware.

I dont really get your Error I think you miss some lib's.
I will asume you are using this : https://www.wxwidgets.org/

Even If you are using Mac OS X, I will explain how to use this external lib on windows with Mingw (TheIDE Default compiler). I guess the theory is the same for Mac OS X.

First of all, to use external lib's with Mingw you (80% of time) need to compile source of the lib with your compiler.
(Here is the tutorial I used to do it : https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW)
After downloading and unzipping wxWidgets, you must (by command prompt) move to Build/Msw

https://i.imgur.com/TRWJyD7.png

and type: mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release clean
then : mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1

(Note to do mingw32-make you need to inquire Mingw Bin folder path to your PATH variable environment (Here is a shard of my PATH Variable : ... ;C:\Upp\upp\bin\mingw64\64\bin;C:\Upp\upp\bin\mingw64\32\bin ; ... ))

https://i.imgur.com/0kD6Phn.png

At the end of compilation (it took 1 hour to me) go to lib file wxWidgets/lib and you should find lot of "*.a" in gcc_lib folder. All this .a are lib's that you can use with your compiler.


On windows ( I think the theory is the same on Mac OS X) when you want use lib you must (in most case) say to your IDE Where to find several file's :

https://i.imgur.com/hJgbGKr.png

First of all, "include files"(all .h referencing external lib(.a))
In the case of TheIDE, you must go in "Setup-> Build Methods" then in include directories, right click and add wxWidget include folder as follow. (Note, I include two different folder from wxWidget, one contain Setup.h when the other contain all class and function definition)


https://i.imgur.com/SUtPpa9.png

Second thing to add is lib directories ( all *.a)
Same as include :

https://i.imgur.com/4uJXDSD.png

then press "Ok".

Here is the little programme I use to test my build (to find a better exemple go here https://docs.wxwidgets.org/stable/overview_helloworld.html= :
wxWidgetTest.cpp
#include <Core/Core.h>

// wxWidgets "Hello world" Program
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#include <wx/wx.h>
using namespace Upp;

CONSOLE_APP_MAIN
{
	wxApp app;
	app.OnInit();
	
}


If you try to compile it at this time, you will get Linking error, Even if we had add Lib and Include to compiler setting, we forget to tell compiler what lib to use. To do this, you must go in TheIDE and right click your package and go to Package Organizers

https://i.imgur.com/h649NHQ.png

Then, right click and select adding a new lib :

https://i.imgur.com/UYYnTwx.png

Add all this lib : wxzlibd wxexpat wxjpeg wxmsw31u wxmsw31u_gl wxpng wxregexu wxregexud wxscintilla wxtiff wxzlib
https://i.imgur.com/LhzmkeY.png
Then when you compile, it should works !

Hope this helped you.
Have a good day

Edit 1 : After trying I got some Linking Error, I will dig up to find what lib is missing but I still post this respons to help you.

@To Upp community, if someone find a misstake or I say bullshit feel free to correct me, I will update the poste.

 
Read Message icon3.gif
Read Message
Read Message
Previous Topic: Upp::Vector FindIndex by value of Object
Next Topic: [SOLVED]How I can put an image in a form like a splash screen??
Goto Forum:
  


Current Time: Mon Apr 29 11:31:16 CEST 2024

Total time taken to generate the page: 0.02154 seconds