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?)
icon3.gif  How to include files .h or .cpp as external library? [message #52682] Sun, 10 November 2019 20:18 Go to next message
fasasoftware is currently offline  fasasoftware
Messages: 14
Registered: July 2019
Location: Italy
Promising Member
How to include files .h or .cpp as external library?

Hi, i'm trying to include under mac os x in ultimate++ the wxwidget library, without success....

At first, i have created with wxformbuilder 3.6.2 that run ok in my mac system 10.13.6 ....2 files with a minimal gui, created with the last tool wxformbuilder 3.6.2

i have created them from the wxwidget gui example from the site...here i enclose here the 2 files plus a hello world alsways taken from wxwidget folder 3.1.3...

i have take the wx folder inside wxwidget folder 3.1.3 and pasted to a new folder called "fasacode" where are located my example files ...

TheIde compile.. give me many errors like:
/Users/saverio/Desktop/fasacode/fasacode.h (11): error: 'wx/artprov.h' file not found with <angled> include; use "quotes" instead
/Users/saverio/Desktop/fasacode/wx/artprov.h (11): error: unknown type name 'wxString'
/Users/saverio/Desktop/fasacode/wx/artprov.h (16): error: unknown type name 'wxString'
/Users/saverio/Desktop/fasacode/wx/artprov.h (254): error: expected class name
/Users/saverio/Desktop/fasacode/wx/artprov.h (281): error: unknown type name 'wxBitmap'
/Users/saverio/Desktop/fasacode/wx/artprov.h (283): error: unknown type name 'wxSize'
/Users/saverio/Desktop/fasacode/wx/artprov.h (289): error: unknown type name 'wxIcon'
/Users/saverio/Desktop/fasacode/wx/artprov.h (291): error: unknown type name 'wxSize'
/Users/saverio/Desktop/fasacode/wx/artprov.h (306): error: unknown type name 'wxSize'
/Users/saverio/Desktop/fasacode/wx/artprov.h (318): error: unknown type name 'wxSize'
/Users/saverio/Desktop/fasacode/wx/artprov.h (333): error: unknown type name 'wxIconBundle'
/Users/saverio/Desktop/fasacode/wx/artprov.h (397): error: unknown type name 'wxIcon'
/Users/saverio/Desktop/fasacode/wx/artprov.h (424): error: unknown type name 'wxBitmap'
 (): virtual wxBitmap CreateBitmap(const wxArtID& id,
/Users/saverio/Desktop/fasacode/wx/artprov.h (426): error: unknown type name 'wxSize'
/Users/saverio/Desktop/fasacode/wx/artprov.h (432): error: unknown type name 'wxIconBundle'
/Users/saverio/Desktop/fasacode/wx/artprov.h (283): error: use of undeclared identifier 'wxDefaultSize'
/Users/saverio/Desktop/fasacode/wx/artprov.h (291): error: use of undeclared identifier 'wxDefaultSize'
/Users/saverio/Desktop/fasacode/fasacode.h (12): error: 'wx/xrc/xmlres.h' file not found with <angled> include; use "quotes" instead
/Users/saverio/Desktop/fasacode/wx/xrc/xmlres.h (48): error: expected class name



Can somebody Help me please???
Best regards,
Lestroso Embarassed
  • Attachment: my test.zip
    (Size: 2.46KB, Downloaded 26 times)
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 next message
Xemuth is currently offline  Xemuth
Messages: 181
Registered: August 2018
Location: France
Experienced 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.



Re: How to include files .h or .cpp as external library? [message #52699 is a reply to message #52682] Tue, 12 November 2019 18:27 Go to previous message
fasasoftware is currently offline  fasasoftware
Messages: 14
Registered: July 2019
Location: Italy
Promising Member
Dear Xemuth,

Thank you very much for the detailed answer...but unfortunetly i can't compile with MinGw...
because in Macosx there's Clang++ and gdb compiler but, you open my eyes to see the steps to follow,
to load the library..i'll take a look again to learn how to use them..

Thanks a lot again...i appriciate a lot your help...

Best regards,

Lestroso Very Happy
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: Sun Jul 05 18:17:18 CEST 2020

Total time taken to generate the page: 0.00938 seconds