Author Topic: How to tell Code::Blocks where wxWidgets is?  (Read 12412 times)

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
How to tell Code::Blocks where wxWidgets is?
« on: August 08, 2018, 09:51:46 pm »
I installed wxWidgets 3.0.3 using the command sequence for my Ubuntu 16.04 OS (xenial) using these instructions:
http://codelite.org/LiteEditor/WxWidgets303Binaries
I am using wxWidgets 3.0.3 because that was the latest and greatest when the project was started on a Windows 7 Machine. On that Windows 7 machine I tried to upgrade to wxWidgets 3.0.4 and got a lot of errors I did not have time to deal with. Now attempting to migrate it to my Ubuntu machine using  Code::Blocks 17.12 with wxWidgets 3.0.3

Now in Ubuntu Code::Blocks  does not know where wxWidgets is. All wxWigets classes got undefined errors. So I followed the instructions at:
https://wiki.wxwidgets.org/Wx-Config
As I understand them. To do this I went to Project => Build Options => Compiler Flags .  In this tab I right clicked and selected "New Flag". I selected the General Category. In the Name field I entered: "wxWidgets". In the Compiler flags field I entered `wx-config --cxxflags`. And in the Linker flags field I entered: `wx-config --libs`

When attempted to compile I got the error:
Quote
wx-config  No such file or directory
So I executed this command on and got this respoonse:
Code
which wx-config
/usr/local/bin/wx-config
And then put the path in the flags such that I have now for those two flags:
Code
Compiler flags: `/usr/local/bin/wx-config --cxxflags`
Linker Flags: `/usr/local/bin/wx-config --libs`

And got the same error. Then I tried exchanging ` for ' so that now I have:
Code
Compiler flags: '/usr/local/bin/wx-config --cxxflags'
Linker Flags: '/usr/local/bin/wx-config --libs'

And I got the compile error:
Quote
error ld returned 1 exit status
I do not know where to go with this from here. Do I have the wx-config flags entered correctly? If they are what is to be done about the "ld returned 1" error?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #2 on: August 08, 2018, 11:56:16 pm »
That link is broken due to a missing closing ) character. I got to the page you intended though.

That error message was from the "Build messages" tab. From the link you gave me I know to look in the "Build log" tab. The error I see there is:
Quote
/usr/local/bin/wx-config: file not recognized: File format not recognized
Why is this file format not recognized?
« Last Edit: August 09, 2018, 04:12:34 am by spflanze »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #3 on: August 09, 2018, 10:05:30 am »
If you post the full build we might be able to tell you.
Most probably you're not using the correct quotation character (backtick, ` `).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #4 on: August 09, 2018, 06:14:49 pm »
The project files can be downloaded from: http://www.mediafire.com/file/4mryj4428z2nf11/TIA_Designer_2018-08-03_for_forum.zip/file .

In the included cbp file I changed the apostrophe back to the back tick.

Your help is much appreciated.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #5 on: August 10, 2018, 01:40:59 pm »
The project file won't help because we do not have your build environment. Please post a full rebuild log described here:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
Also remember to restart codeblocks if you change something in your build chain. For example if you replace your wx-config you have to restart codeblocks, because cb caches the output of wx-config....

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #6 on: August 10, 2018, 01:45:51 pm »
Quote
In the included cbp file I changed the apostrophe back to the back tick.
not everywhere:
Code
<Target title="Debug">
<Option output="bin/Debug/TIA Designer" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="&apos;wx-config --cxxflags&apos;" />
<Add option="-g" />
</Compiler>
<Linker>
<Add option="`wx-config --libs`" />
</Linker>
</Target>

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #7 on: August 10, 2018, 03:36:56 pm »
The build log:
Code
-------------- Clean: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------

Cleaned "TIA Designer - Debug"

-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------

g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread 'wx-config --cxxflags' -g -g -I../Libraries/cminpack-1.3.6 -Iinclude -c "/home/me/Engineering Software/Libraries/cminpack-1.3.6/cpp/dpmpar.cpp" -o obj/Debug/Libraries/cminpack-1.3.6/cpp/dpmpar.o
g++: error: wx-config: No such file or directory
g++: fatal error: no input files
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #8 on: August 10, 2018, 04:37:08 pm »
Code
'wx-config --cxxflags'

And, why did you not change these to back ticks?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #9 on: August 11, 2018, 09:11:09 am »
Because on page:
https://wiki.wxwidgets.org/Wx-Config
It is the back tick that is used. Changing to the apostrophe was an experiment that failed to get it compiled, although the error was different.

I used the back tick in the flags, but I see in the build log enclosing apostrophes in the -pthread option's parameter. Should that be?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #10 on: August 11, 2018, 11:01:41 am »
i do not understand your last answer... But in general:
Backticks
Code
`this is executed`
are executed by codeblocks and the stdout output of this program replaces the text within the backticks....

For example
Code
`wx-config --cflags`
will be replaced by
Code
-I/usr/local/lib/wx/include/gtk2-unicode-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
on my machine....

"Normal" ticks
Code
'this is passed trough the command line'
will expand to
Code
'this is passed trough the command line'

In your last build log are still the normal ticks for the compiler flags...
If you have changed them and still get errors post the new build log...

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #11 on: August 11, 2018, 09:44:25 pm »
When these flags are in effect:
Code
`/usr/local/bin/wx-config --cxxflags`
`/usr/local/bin/wx-config --libs`
The build log is:
Quote
-------------- Clean: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------

Cleaned "TIA Designer - Debug"

-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------

g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread -I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread -g '/usr/local/bin/wx-config --cxxflags' 'wx-config --cxxflags' -I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread -g -I../Libraries/cminpack-1.3.6 -Iinclude -c "/home/me/Engineering Software/Libraries/cminpack-1.3.6/cpp/dpmpar.cpp" -o obj/Debug/Libraries/cminpack-1.3.6/cpp/dpmpar.o
/usr/local/bin/wx-config: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

So now I get the same error whether  ' or `is used. This time I was closing and reopening Code::Blocks after this was changed and before the compile attempt.

When these flags are in effect:
Code
'/usr/local/bin/wx-config --cxxflags'
'/usr/local/bin/wx-config --libs'
The build log is:
Quote
-------------- Clean: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------

Cleaned "TIA Designer - Debug"

-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------

g++ -Wall -I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread '/usr/local/bin/wx-config --cxxflags' -g 'wx-config --cxxflags' '/usr/local/bin/wx-config --cxxflags' -g -I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread -I../Libraries/cminpack-1.3.6 -Iinclude -c "/home/me/Engineering Software/Libraries/cminpack-1.3.6/cpp/dpmpar.cpp" -o obj/Debug/Libraries/cminpack-1.3.6/cpp/dpmpar.o
/usr/local/bin/wx-config: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
So now I get the same error. This time I was closing and reopening Code::Blocks after the change and before the compile attempt.

For the wx global variable in Settings => Global I have as base:
Quote
/home/me/Packages/wxWidgets-3.0.3
This path does not exist on my drive. The path:
Quote
/usr/include/wx-3.0-unofficial
does.  Is this what I should set wx to?
I believe this path was put there by the commands I used to do the install instrucitons at: http://codelite.org/LiteEditor/WxWidgets303Binaries





« Last Edit: August 11, 2018, 10:14:29 pm by spflanze »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #12 on: August 12, 2018, 12:29:28 am »
1. When using wx-config you don't care for any other settings or paths
2. Please inspect all project settings and global settings and remove the inappropriate wx-config values. From your log it is pretty clear that you've entered different and incorrect (using '' instead of ``) in at least two places! I guess there are more. And make sure you don't mix different wx-configs. You'll suffer a lot if you do it and it will be really hard to debug!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #13 on: August 12, 2018, 01:15:50 am »
The two places you see it, I do not have control over. The opening and closing " you see after -Iinclude -c enclose a path to a file that was brought in to the project by right clicking the project in the Manager's Projects tab and selecting "Add files".

I have eliminated the wx global variable.

I still get the same error. I have attached the latest project file.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to tell Code::Blocks where wxWidgets is?
« Reply #14 on: August 12, 2018, 08:20:53 am »
This is a simple text search in the file you've sent:
Code
$ grep wx-config TIA\ Designer.cbp 
<Add option="&apos;/usr/local/bin/wx-config --cxxflags&apos;" />
<Add option="&apos;/usr/local/bin/wx-config --libs&apos;" />
<Add option="&apos;/usr/local/bin/wx-config --cxxflags&apos;" />
<Add option="&apos;/usr/local/bin/wx-config --libs&apos;" />
<Add option="`/usr/local/bin/wx-config --cxxflags`" />
<Add option="`/usr/local/bin/wx-config --libs`" />
So you have 4 time the incorrect version of the wx-config.

Go inspect the configurations for all targets and the project options. On the left side of the dialog Project -> Build options you should see a tree control. This control is used to select the build targets or project options. Please inspect and fix them all.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]