LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-24-2009, 08:26 PM   #1
icecubeflower
Member
 
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 313

Rep: Reputation: 34
#include and linker flags


If I write a super simple wxwidgets program I can compile it like this:
g++ hworld.cpp `wx-config --libs` `wx-config --cxxflags` -o hworld

I assume it found the .h files because I ran ldconfig after installing wxwidgets.

Do the flags in back quotes include the entire set of libraries? Is it overkill?

Also how do I do the same thing in an IDE like Code::Blocks? I can start a WxWidgets project with the wizard and it will compile but I cannot find anywhere in the build options where it has the linker flags. Are they hidden somewhere?

I want to know how to start a wxwidgets project without the wizard but I cannot figure out how. It will never compile. Why doesn't it work like it did at the command prompt? Do I have to tell Code::Blocks what directories to search for .h files? And if so how come when I started a wxwidgets project with the wizard I could not find anything in the build options that told it what directories to search? Why does the wizard's project magically compile?
 
Old 11-24-2009, 09:11 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Quote:
If I write a super simple wxwidgets program I can compile it like this:
g++ hworld.cpp `wx-config --libs` `wx-config --cxxflags` -o hworld
Quote:
Good
I assume it found the .h files because I ran ldconfig after installing wxwidgets.
Quote:
Yup
Do the flags in back quotes include the entire set of libraries? Is it overkill?
Quote:
Nope

Also how do I do the same thing in an IDE like Code::Blocks? I can start a WxWidgets project with the wizard and it will compile but I cannot find anywhere in the build options where it has the linker flags. Are they hidden somewhere?
I'm sure you've got several alternatives.

But one easy approach is to just:

1. Type "wx-config --libs` `wx-config --cxxflags" from a command line

2. Cut/paste the resulting "-Ixxx and -Lyyy" flags into whatever IDE you're using.

'Hope that helps .. PSM
 
Old 11-24-2009, 09:19 PM   #3
icecubeflower
Member
 
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 313

Original Poster
Rep: Reputation: 34
It doesn't show any:
Code:
icecube@inferno:~$ g++ fun.cpp `wx-config --libs` `wx-config --cxxflags` -o fun
icecube@inferno:~$
I don't think linking is the problem. It's that it never finds the .h files in Code::Blocks. First it says wx/wx.h not found. So I add /usr/local/include/wx-2.8 to search directores. But then it says wx/setup.h not found. I keep adding wx directories to make it happy but in doesn't work.

Can I stick `wx-config --libs` `wx-config --cxxflags` into linker options in Codeblocks? I tried but I don't think it works.
 
Old 11-24-2009, 09:22 PM   #4
icecubeflower
Member
 
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 313

Original Poster
Rep: Reputation: 34
And just suppose I compile at command line and it showed me linker flags like you said and I copied them into CodeBlocks and it worked. Why are there no linker flags when you start wxwidget project with the wizard and why does it compile just fine without them? I think they are hidden somewhere, maybe in the makefile.
 
Old 11-24-2009, 09:28 PM   #5
icecubeflower
Member
 
Registered: Mar 2008
Location: USA
Distribution: Slackware 13.1
Posts: 313

Original Poster
Rep: Reputation: 34
They are all in a .depend file.
Code:
# depslib dependency file v1.0
1259117114 source:/home/icecube/asdff/asdffApp.cpp
	"wx_pch.h"
	"asdffApp.h"
	"asdffMain.h"

1259117114 /home/icecube/asdff/asdffApp.h
	<wx/app.h>

1259116434 /usr/local/include/wx-2.8/wx/app.h
	"wx/event.h"
	"wx/build.h"
	"wx/init.h"
	"wx/intl.h"
	"wx/palmos/app.h"
	"wx/msw/app.h"
	"wx/motif/app.h"
	"wx/mgl/app.h"
	"wx/dfb/app.h"
	"wx/gtk/app.h"
	"wx/gtk1/app.h"
	"wx/x11/app.h"
	"wx/mac/app.h"
	"wx/cocoa/app.h"
	"wx/os2/app.h"
	"wx/univ/theme.h"

1259116434 /usr/local/include/wx-2.8/wx/event.h
	"wx/defs.h"
	"wx/cpp.h"
	"wx/object.h"
	"wx/clntdata.h"
	"wx/gdicmn.h"
	"wx/cursor.h"
	"wx/thread.h"
	"wx/dynarray.h"

1259116434 /usr/local/include/wx-2.8/wx/defs.h
	"wx/platform.h"
	"wx/features.h"
	"wx/version.h"
	"wx/dlimpexp.h"
	"wx/debug.h"
	<stddef.h>
	<sys/types.h>
	<unistd.h>
	"wx/msw/winundef.h"

1259116434 /usr/local/include/wx-2.8/wx/platform.h
	<stddef.h>
	<AvailabilityMacros.h>
	<unistd.h>
	"wx/mac/carbon/config_xcode.h"
	"wx/setup.h"
	"wx/chkconf.h"
	"wx/msw/wince/libraries.h"
	"wx/msw/libraries.h"
	"wx/msw/gccpriv.h"
	<AvailabilityMacros.h>

1259116434 /usr/local/lib/wx/include/gtk2-ansi-release-2.8/wx/setup.h

1259116434 /usr/local/include/wx-2.8/wx/chkconf.h
	"wx/palmos/chkconf.h"
	"wx/msw/wince/chkconf.h"
	"wx/msw/chkconf.h"
	"wx/mac/chkconf.h"
	"wx/os2/chkconf.h"
	"wx/mgl/chkconf.h"
	"wx/dfb/chkconf.h"
	"wx/motif/chkconf.h"
	"wx/x11/chkconf.h"
	"wx/univ/chkconf.h"

1259116434 /usr/local/include/wx-2.8/wx/features.h

1259116434 /usr/local/include/wx-2.8/wx/version.h
	"wx/cpp.h"

1259116434 /usr/local/include/wx-2.8/wx/cpp.h

1259116434 /usr/local/include/wx-2.8/wx/dlimpexp.h

1259116434 /usr/local/include/wx-2.8/wx/debug.h
	<assert.h>
	<limits.h>
	"wx/wxchar.h"

1259116434 /usr/local/include/wx-2.8/wx/wxchar.h
	"wx/platform.h"
	"wx/dlimpexp.h"
	<stdio.h>
	<stdarg.h>
	<sys/types.h>
	<wchar.h>
	<wcstr.h>
	<stdlib.h>
	<widec.h>
	<ctype.h>
	<memory.h>
	<stddef.h>
	<stddef.h>
	<string.h>
	<ctype.h>
	<tchar.h>
	<ctype.h>
	<ctype.h>
	<stdio.h>
	<wctype.h>
	<stdio.h>
	<stdio.h>
	<ctype.h>
	<string.h>
	<stdio.h>
	<time.h>
	<time.h>
	<string.h>

1259116434 /usr/local/include/wx-2.8/wx/object.h
	"wx/memory.h"
	"wx/xti.h"
	"wx/msw/msvcrt.h"

1259116434 /usr/local/include/wx-2.8/wx/memory.h
	"wx/defs.h"
	"wx/string.h"
	"wx/msgout.h"
	<stddef.h>

1259116434 /usr/local/include/wx-2.8/wx/string.h
	"wx/defs.h"
	<ctype.h>
	<stdio.h>
	<string.h>
	<stdarg.h>
	<limits.h>
	<string.h>
	<stdio.h>
	<stdarg.h>
	<limits.h>
	<stdlib.h>
	<strings.h>
	<StringMgr.h>
	"wx/wxchar.h"
	"wx/buffer.h"
	"wx/strconv.h"
	"wx/beforestd.h"
	<string>
	"wx/afterstd.h"
	"wx/arrstr.h"
	"wx/iosfwrap.h"

1259116434 /usr/local/include/wx-2.8/wx/buffer.h
	"wx/wxchar.h"
	<stdlib.h>

1259116434 /usr/local/include/wx-2.8/wx/strconv.h
	"wx/defs.h"
	"wx/wxchar.h"
	"wx/buffer.h"
	"typeinfo.h"
	<stdlib.h>
	"wx/fontenc.h"

1259116434 /usr/local/include/wx-2.8/wx/fontenc.h

1259116434 /usr/local/include/wx-2.8/wx/beforestd.h

1259116434 /usr/local/include/wx-2.8/wx/afterstd.h
	"wx/msw/winundef.h"

1259116434 /usr/local/include/wx-2.8/wx/arrstr.h
	"wx/defs.h"
	"wx/string.h"
	"wx/dynarray.h"

1259116434 /usr/local/include/wx-2.8/wx/dynarray.h
	"wx/defs.h"
	"wx/beforestd.h"
	<vector>
	<algorithm>
	"wx/afterstd.h"

1259116434 /usr/local/include/wx-2.8/wx/iosfwrap.h
	<iostream.h>
	<iosfwd>
	"wx/msw/winundef.h"

1259116434 /usr/local/include/wx-2.8/wx/msgout.h
	"wx/defs.h"
	"wx/wxchar.h"

1259116434 /usr/local/include/wx-2.8/wx/xti.h
	"wx/defs.h"
	"wx/memory.h"
	"wx/flags.h"
	"wx/string.h"
	"wx/arrstr.h"
	"wx/hashmap.h"
	"wx/log.h"
	"wx/intl.h"
	<typeinfo>
	"wx/dynarray.h"

1259116434 /usr/local/include/wx-2.8/wx/hashmap.h
	"wx/string.h"
	<unordered_map>
	<tr1/unordered_map>
	<ext/hash_map>
	<hash_map>
	<stddef.h>

1259116434 /usr/local/include/wx-2.8/wx/log.h
	"wx/defs.h"
	"wx/string.h"
	"wx/arrstr.h"
	<time.h>
	"wx/dynarray.h"
	"wx/iosfwrap.h"
	"wx/generic/logg.h"
	"wx/cocoa/log.h"

1259116435 /usr/local/include/wx-2.8/wx/generic/logg.h

1259116434 /usr/local/include/wx-2.8/wx/intl.h
	"wx/defs.h"
	"wx/string.h"
	"wx/fontenc.h"

1259116434 /usr/local/include/wx-2.8/wx/clntdata.h
	"wx/defs.h"
	"wx/string.h"
	"wx/hashmap.h"
	"wx/vector.h"

1259116434 /usr/local/include/wx-2.8/wx/vector.h
	"wx/defs.h"

1259116435 /usr/local/include/wx-2.8/wx/gdicmn.h
	"wx/defs.h"
	"wx/list.h"
	"wx/string.h"
	"wx/fontenc.h"
	"wx/hashmap.h"

(much longer than this)
I don't understand. Codeblocks is using gcc. I guess it does not use make? I remember with KDevelop it made configure.in files and makefile.am and makefile. I guess I will just use the wizard.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Recursively include headers in include option for gcc kvm1983 Linux - Newbie 5 09-04-2012 03:21 PM
[SOLVED] cryptic linker error (i really dont like linker errors); smeezekitty Programming 2 09-19-2009 02:21 AM
libraries and linker flags icecubeflower Programming 4 09-08-2009 06:22 PM
changing include directories - /usr/local/include quep_fly Linux - Newbie 6 08-12-2007 04:36 PM
Compilation flags and linker warnings alanwolfen Programming 4 02-24-2005 08:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration