Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: arwen on October 18, 2006, 02:58:43 pm
-
I have develop a little application on WxDevC++ on windows in order to learn to use wxwidget.
In this application I use wxMathPlot
http://wxmathplot.sourceforge.net/ (http://wxmathplot.sourceforge.net/)
and in order to not use wxmathplot like library I
include the mathplot.cpp and mathplot.h in my source .
In windows with wxDev-C++ I don't have any problem but when I try to compile on Linux
with Code::Blocks I receive many errors .
Help , where mistake?
The same things appen if I try to make a project in code::bloks that have as source the
mathplot.cpp
mathplot.h
and the demo source of mathplot mp1.cpp
Below some errors that I receive
:: === TestPlot, Debug ===
/home/franaria/Projects/TestPlot/mathplot.cpp:480: undefined reference to `mpWindow::SetPos(double, double)'
/home/franaria/Projects/TestPlot/mathplot.cpp:542: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:542: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:542: undefined reference to `mpWindow::SetPosX(double)'
/home/franaria/Projects/TestPlot/mathplot.cpp:546: undefined reference to `mpWindow::GetScaleY() const'
..................
..................
..................
:: More errors follow but not being shown.
:: Edit the max errors limit in compiler options...
:: === Build finished: 50 errors, 0 warnings ===
How I can resolve?
I know that this is not a programming section but I do not know where to blink my head.
Therefore I ask excuse
Thanks to All
-
//-- Full Compile Logging --
Main Menu->Settings->Compiler and Debugger->"Other"->Compiler logging = "Full command line".
Could you turn on command line logging and paste the results here or attach a zip file. You can copy the log via right-mouse-select-all/copy
Also check "Project Build Options" linker and includes to make sure the correct libraries are specified.
-
Thanks Pecan !! :D
Here you can download the little test code that I can't compile aria.francesco.googlepages.com/TestPlot.tar.gz (http://aria.francesco.googlepages.com/TestPlot.tar.gz)
Below there is the Build log
-------------- Build: Debug in TestPlot ---------------
g++ -L/usr/lib -o bin/Debug/TestPlot obj/Debug/mathplot.o obj/Debug/mp1.o `wx-config --libs`
obj/Debug/mathplot.o: In function `mpWindow::OnCenter(wxCommandEvent&)':
/home/franaria/Projects/TestPlot/mathplot.cpp:480: undefined reference to `mpWindow::SetPos(double, double)'
obj/Debug/mathplot.o: In function `mpWindow::OnScroll2(wxScrollWinEvent&)':
/home/franaria/Projects/TestPlot/mathplot.cpp:542: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:542: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:542: undefined reference to `mpWindow::SetPosX(double)'
/home/franaria/Projects/TestPlot/mathplot.cpp:546: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:546: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:546: undefined reference to `mpWindow::SetPosY(double)'
obj/Debug/mathplot.o: In function `mpWindow::UpdateAll()':
/home/franaria/Projects/TestPlot/mathplot.cpp:588: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:589: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:590: undefined reference to `mpWindow::GetPosX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:590: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:591: undefined reference to `mpWindow::GetPosY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:591: undefined reference to `mpWindow::GetScaleY() const'
obj/Debug/mathplot.o: In function `mpWindow::wxCreateObject()':
/home/franaria/Projects/TestPlot/mathplot.cpp:352: undefined reference to `mpWindow::mpWindow()'
obj/Debug/mathplot.o: In function `~mpWindow':
/home/franaria/Projects/TestPlot/mathplot.cpp:393: undefined reference to `vtable for mpWindow'
/home/franaria/Projects/TestPlot/mathplot.cpp:393: undefined reference to `vtable for mpWindow'
/home/franaria/Projects/TestPlot/mathplot.cpp:393: undefined reference to `vtable for mpWindow'
obj/Debug/mathplot.o: In function `mpWindow':
/home/franaria/Projects/TestPlot/mathplot.cpp:369: undefined reference to `vtable for mpWindow'
/home/franaria/Projects/TestPlot/mathplot.cpp:369: undefined reference to `vtable for mpWindow'
obj/Debug/mathplot.o: In function `mpScaleY::Plot(wxDC&, mpWindow&)':
/home/franaria/Projects/TestPlot/mathplot.cpp:304: undefined reference to `mpWindow::GetPosX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:304: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:305: undefined reference to `mpWindow::GetScrY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:309: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:311: undefined reference to `mpWindow::GetPosY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:311: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:327: undefined reference to `mpWindow::GetPosY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:327: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:332: undefined reference to `mpWindow::GetPosY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:332: undefined reference to `mpWindow::GetScaleY() const'
obj/Debug/mathplot.o: In function `mpScaleX::Plot(wxDC&, mpWindow&)':
/home/franaria/Projects/TestPlot/mathplot.cpp:246: undefined reference to `mpWindow::GetPosY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:246: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:247: undefined reference to `mpWindow::GetScrX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:251: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:253: undefined reference to `mpWindow::GetPosX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:253: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:269: undefined reference to `mpWindow::GetPosX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:269: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:274: undefined reference to `mpWindow::GetPosX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:274: undefined reference to `mpWindow::GetScaleX() const'
obj/Debug/mathplot.o: In function `mpFXY::Plot(wxDC&, mpWindow&)':
/home/franaria/Projects/TestPlot/mathplot.cpp:172: undefined reference to `mpWindow::GetPosY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:172: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:172: undefined reference to `mpWindow::GetPosX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:172: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:179: undefined reference to `mpWindow::GetPosX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:179: undefined reference to `mpWindow::GetScaleX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:180: undefined reference to `mpWindow::GetPosY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:180: undefined reference to `mpWindow::GetScaleY() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:194: undefined reference to `mpWindow::GetScrX() const'
/home/franaria/Projects/TestPlot/mathplot.cpp:195: undefined reference to `mpWindow::GetScrY() const'
obj/Debug/mathplot.o: In function `mpFY::Plot(wxDC&, mpWindow&)':
/home/franaria/Projects/TestPlot/mathplot.cpp:117: undefined reference to `mpWindow::GetScrY() const'
Process terminated with status 1 (0 minutes, 1 seconds)
50 errors, 0 warnings
-
i guess, your problem is, that wx-config isn't installed on your linux computer,
or you don't have it in your path
-------------- Build: Debug in TestPlot ---------------
g++ -L/usr/lib -o bin/Debug/TestPlot obj/Debug/mathplot.o obj/Debug/mp1.o `wx-config --libs`
`wx-config --libs` should expand to the wx libraries
the erros are coming, because g++ can't find the necessary libraries
brgds, tiwag
-
The problem can be what tiwag mentioned, to eliminate this option, try to run wx-config (or type 'which wx-config')
If wx-config exist under your Linux, try this:
1. try to replace in your makefile, `wx-config --libs` with $(shell wx-config --libs), I saw some versions of makefiles that do not expand command line properly and needed this 'shell' command to help them out.
2. If I am not mistaken, wx-config accepts another parameters after the '--libs' flags, for example: "--debug=yes --unicode=no". but I can be wrong on this one and it has default parameters ( I dont have my Linux box infront of me, so cant really say)
EDIT:
If `wx-config` does not exist, how did you get to the link part? Why didnt you fail in compile, which also uses `wx-config --cflags`?
HTH,
Eran
-
i guess, your problem is, that wx-config isn't installed on your linux computer,
or you don't have it in your path
-------------- Build: Debug in TestPlot ---------------
g++ -L/usr/lib -o bin/Debug/TestPlot obj/Debug/mathplot.o obj/Debug/mp1.o `wx-config --libs`
`wx-config --libs` should expand to the wx libraries
the erros are coming, because g++ can't find the necessary libraries
brgds, tiwag
Most windows systems do not have wx-config. It's a linux thingie.
However, you can go to your linux machine and start a shell, then type
"wx-config --cflags" (without quotes) to see the compile flags needed,
and
"wx-config --libs" (without quotes) to see the libraries needed.
put those in the build options for your project. You may need to specify the windows paths for those libs (as opposed to the linux paths)
For Example:
(http://img225.imageshack.us/img225/5572/graphic10182006112835amno0.png).
-
1. try to replace in your makefile, `wx-config --libs` with $(shell wx-config --libs), I saw some versions of makefiles that do not expand command line properly and needed this 'shell' command to help them out.
he is using the codeblocks project file to build (see download link)
i could build his project fine, just some modifications to the mathplot lib were necessary,
because i build and link it statically, and it was setup for building a shared library.
therefore i had only to
#undef WXDLLEXPORT
#define WXDLLEXPORT
in mathplot.h
but the project setup is ok !
and you are right, if wx-config wouldn't exist, he would have got errors during compiling.
strange...
-
Just clearing some misconceptions:
1. try to replace in your makefile, `wx-config --libs` with $(shell wx-config --libs), I saw some versions of makefiles that do not expand command line properly and needed this 'shell' command to help them out.
the $(shell command) variant is for shells that doesn't support backticks, just like cmd.exe / command.com in Windows.
2. If I am not mistaken, wx-config accepts another parameters after the '--libs' flags, for example: "--debug=yes --unicode=no". but I can be wrong on this one and it has default parameters ( I dont have my Linux box infront of me, so cant really say)
Yes those flags exists both in Windows and Linux versions, however most of the time they're not necessary unless you have multiple configurations.
Most windows systems do not have wx-config. It's a linux thingie.
Not really, http://wxconfig.googlepages.com
Coming soon as option for wxWidgets wizard, wxSmith wizard and C::B Plugin wizard (indeed I've already made them, just waiting for patch approval :) ).
-
In my linux box (fedora core 5) wx-config is installed and I can compile in C:B the
project created with the wxWidgetApplication template without problem.
tiwag wrote
i could build his project fine, just some modifications to the mathplot lib were necessary,
because i build and link it statically, and it was setup for building a shared library.
therefore i had only to
#undef WXDLLEXPORT
#define WXDLLEXPORT
in mathplot.h
How I must modify mathplot.h to compile .
Thanks to all
-
Most windows systems do not have wx-config. It's a linux thingie.
Not really, http://wxconfig.googlepages.com
Coming soon as option for wxWidgets wizard, wxSmith wizard and C::B Plugin wizard ...
i used your wx-config-win too and it works very well indeed.
there is only one big problem: codecompletion isn't working when
you setup your cb-project using wx-config, because the path to the
include files isn't know for CB during editing.
therefore i switched back to the standard custom-variables project setup
for my default projects.
just my expierience with that issue ...
-
i used your wx-config-win too and it works very well indeed.
there is only one big problem: codecompletion isn't working when
you setup your cb-project using wx-config, because the path to the
include files isn't know for CB during editing.
Well, being fair, that's the same issue all *nix/mac developers are having right now not only with wx but with almost all libraries since most of them use back-ticks for obtaining include paths, flags and libraries to link with.
So this is a really an issue of the CodeCompletion plugin which is solvable and will be fixed in the future.
therefore i switched back to the standard custom-variables project setup
for my default projects.
So that's why I've made it option in the wizard for the time being, until the above issue get's resolved in CodeCompletion. :)
Patch here: https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1569&group_id=5358
-
So that's why I've made it option in the wizard for the time being, until the above issue get's resolved in CodeCompletion. Smile
I've also been using wx-config-win of late, and it works very well - nice work!
I was just thinking how nice it would be to have a wizard using it ... :D
-
Hey boys as I must modify the mathplot lib ? :(
Below a Build log debug of a project created with the wxWidgetApplication template without problem.
I think that my C::B and wxwidget installation is OK .
Probably there is same Errors in the MathPlot Lib but I can compile it using
wxDev-C++ http://wxdsgn.sourceforge.net/ (http://wxdsgn.sourceforge.net/)
including the mathplot.cpp and matplot.h in my application
and I can't compile on Linux under C::B WHY ??
-------------- Build: Debug in pippo ---------------
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH -Wall -g -I/usr/include -c wx_pch.h -o wx_pch.h.gch/Debug_wx_pch.h.gch
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH -Wall -g -I/usr/include -c app.cpp -o obj/Debug/app.o
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH -Wall -g -I/usr/include -c main.cpp -o obj/Debug/main.o
g++ -L/usr/lib -o bin/Debug/pippo obj/Debug/app.o obj/Debug/main.o `wx-config --libs`
Process terminated with status 0 (0 minutes, 5 seconds)
0 errors, 0 warnings
And this below is the log when i try to compile the example of mathplot
that can be downloaded with the link in the previsius post
-------------- Build: Debug in Plotta ---------------
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH -Wall -g -I/usr/include -c wx_pch.h -o wx_pch.h.gch/Debug_wx_pch.h.gch
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH -Wall -g -I/usr/include -c mathplot.cpp -o obj/Debug/mathplot.o
g++ `wx-config --cflags` -Winvalid-pch -include wx_pch.h -DUSE_PCH -Wall -g -I/usr/include -c mp1.cpp -o obj/Debug/mp1.o
g++ -L/usr/lib -o bin/Debug/Plotta obj/Debug/mathplot.o obj/Debug/mp1.o `wx-config --libs`
obj/Debug/mathplot.o: In function `mpWindow::OnCenter(wxCommandEvent&)':/home/francesco/Progetti/Plotta/mathplot.cpp:480: undefined reference to `mpWindow::SetPos(double, double)'
obj/Debug/mathplot.o: In function `mpWindow::OnScroll2(wxScrollWinEvent&)':/home/francesco/Progetti/Plotta/mathplot.cpp:542: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:542: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:542: undefined reference to `mpWindow::SetPosX(double)'
:/home/francesco/Progetti/Plotta/mathplot.cpp:546: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:546: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:546: undefined reference to `mpWindow::SetPosY(double)'
obj/Debug/mathplot.o: In function `mpWindow::UpdateAll()':/home/francesco/Progetti/Plotta/mathplot.cpp:588: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:589: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:590: undefined reference to `mpWindow::GetPosX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:590: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:591: undefined reference to `mpWindow::GetPosY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:591: undefined reference to `mpWindow::GetScaleY() const'
obj/Debug/mathplot.o: In function `mpWindow::wxCreateObject()':/home/francesco/Progetti/Plotta/mathplot.cpp:352: undefined reference to `mpWindow::mpWindow()'
obj/Debug/mathplot.o: In function `~mpWindow':/home/francesco/Progetti/Plotta/mathplot.cpp:393: undefined reference to `vtable for mpWindow'
:/home/francesco/Progetti/Plotta/mathplot.cpp:393: undefined reference to `vtable for mpWindow'
:/home/francesco/Progetti/Plotta/mathplot.cpp:393: undefined reference to `vtable for mpWindow'
obj/Debug/mathplot.o: In function `mpWindow':/home/francesco/Progetti/Plotta/mathplot.cpp:369: undefined reference to `vtable for mpWindow'
:/home/francesco/Progetti/Plotta/mathplot.cpp:369: undefined reference to `vtable for mpWindow'
obj/Debug/mathplot.o: In function `mpScaleY::Plot(wxDC&, mpWindow&)':/home/francesco/Progetti/Plotta/mathplot.cpp:304: undefined reference to `mpWindow::GetPosX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:304: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:305: undefined reference to `mpWindow::GetScrY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:309: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:311: undefined reference to `mpWindow::GetPosY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:311: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:327: undefined reference to `mpWindow::GetPosY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:327: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:332: undefined reference to `mpWindow::GetPosY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:332: undefined reference to `mpWindow::GetScaleY() const'
obj/Debug/mathplot.o: In function `mpScaleX::Plot(wxDC&, mpWindow&)':/home/francesco/Progetti/Plotta/mathplot.cpp:246: undefined reference to `mpWindow::GetPosY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:246: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:247: undefined reference to `mpWindow::GetScrX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:251: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:253: undefined reference to `mpWindow::GetPosX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:253: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:269: undefined reference to `mpWindow::GetPosX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:269: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:274: undefined reference to `mpWindow::GetPosX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:274: undefined reference to `mpWindow::GetScaleX() const'
obj/Debug/mathplot.o: In function `mpFXY::Plot(wxDC&, mpWindow&)':/home/francesco/Progetti/Plotta/mathplot.cpp:172: undefined reference to `mpWindow::GetPosY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:172: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:172: undefined reference to `mpWindow::GetPosX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:172: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:179: undefined reference to `mpWindow::GetPosX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:179: undefined reference to `mpWindow::GetScaleX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:180: undefined reference to `mpWindow::GetPosY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:180: undefined reference to `mpWindow::GetScaleY() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:194: undefined reference to `mpWindow::GetScrX() const'
:/home/francesco/Progetti/Plotta/mathplot.cpp:195: undefined reference to `mpWindow::GetScrY() const'
obj/Debug/mathplot.o: In function `mpFY::Plot(wxDC&, mpWindow&)':/home/francesco/Progetti/Plotta/mathplot.cpp:117: undefined reference to `mpWindow::GetScrY() const'
Process terminated with status 1 (0 minutes, 6 seconds)
50 errors, 0 warnings
Thanks newly
-
EUREKA !
I find the solution and now I try to compile my application on LINUX
I can compile and run the example at aria.francesco.googlepages.com/TestPlot.tar.gz (http://aria.francesco.googlepages.com/TestPlot.tar.gz)
modifing only the mathplot.h file as blelow
because the difference from a windows & LINUX compiling is there :
//#if defined(__GNUG__) && !defined(__APPLE__)
//#pragma interface "mathplot.h"
//#endif
I rem these 3 lines and i can compile it !!!!!!!
Tank's to all
-
At the URL below there is my little program that I develop
with your aid
So THANKS TO ALL
:D :D :D
http://aria.francesco.googlepages.com/freeforyouacquarius (http://aria.francesco.googlepages.com/freeforyouacquarius)
:D :D :D