Compile and run a wxWidget project

General questions regarding the usage of CodeLite
kea_
CodeLite Curious
Posts: 6
Joined: Tue Sep 23, 2008 10:07 am
Contact:

Compile and run a wxWidget project

Post by kea_ »

Hello all,

My installation: mingw 3.4.5, wxWidget-2.8.8, CodeLite v1.0

My question:
I have looked for docs about the installation for CodeLite and wxWidget but unfortunately I didn't find any things.
So I just created a project an tried to compile and run it.
There where some errors (as I expected):

Building: "mingw32-make" -j 1 -f "MyConsole_wsp.mk" type=Debug
----------Building project:[ MyFrame2 - DebugUnicode ]----------
cc1plus.exe: error: unrecognized command line option "-Wno-attributes"
mingw32-make[1]: *** [DebugUnicode/myframe2_app.o.d] Error 1
mingw32-make: *** [All] Error 2
----------Build Ended----------

Please give me a hint.

Thank you very much
kea_
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compile and run a wxWidget project

Post by eranif »

Some questions:
Do you have wxWidgets installed?

Can u post the content of the generated makefile?
MyFrame2.mk

Quick guess: it looks like a MinGW error. try reinstall MinGW as described here:
http://codelite.org/forum/viewtopic.php?f=3&t=138

Eran
Make sure you have read the HOW TO POST thread
kea_
CodeLite Curious
Posts: 6
Joined: Tue Sep 23, 2008 10:07 am
Contact:

Re: Compile and run a wxWidget project

Post by kea_ »

Yes I have the wxWidget installed.
But I don't know where and how I should set the path to the wxWidget library.
I think this is the main reason for not working.

Greetings kea_

MyFrame.mk
##
## Auto Generated makefile, please do not edit
##
PATH:=$(PATH); D:\programs\Development\MinGW\bin
ProjectName:=MyFrame

## DebugUnicode
ifeq ($(type),DebugUnicode)
ConfigurationName :=DebugUnicode
IntermediateDirectory :=./DebugUnicode
OutDir := $(IntermediateDirectory)
LinkerName:=g++
ArchiveTool :=ar rcu
SharedObjectLinkerName :=g++ -shared -fPIC
ObjectSuffix :=.o
DebugSwitch :=-gstab
IncludeSwitch :=-I
LibrarySwitch :=-l
OutputSwitch :=-o
LibraryPathSwitch :=-L
PreprocessorSwitch :=-D
SourceSwitch :=-c
CompilerName :=g++
OutputFile :=$(IntermediateDirectory)/MyFrame
Preprocessors :=$(PreprocessorSwitch)__WX__
ObjectSwitch :=-o
ArchiveOutputSwitch :=
CmpOptions :=-g $(shell wx-config --cxxflags --unicode=yes --debug=yes) $(Preprocessors)
RcCmpOptions :=$(shell wx-config --rcflags)
RcCompilerName :=windres
LinkOptions := -O2 $(shell wx-config --debug=yes --libs --unicode=yes) -mwindows
IncludePath :=
RcIncludePath :=
Libs :=
LibPath :=
endif

Objects=$(IntermediateDirectory)/myframe_app$(ObjectSuffix) $(IntermediateDirectory)/myframe_frame$(ObjectSuffix)

##
## Main Build Tragets
##
all: $(OutputFile)

$(OutputFile): makeDirStep $(Objects)
$(LinkerName) $(OutputSwitch)$(OutputFile) $(Objects) $(LibPath) $(Libs) $(LinkOptions)

makeDirStep:
@makedir "./DebugUnicode"


PreBuild:


##
## Objects
##
$(IntermediateDirectory)/myframe_app$(ObjectSuffix): myframe_app.cpp $(IntermediateDirectory)/myframe_app$(ObjectSuffix).d
$(CompilerName) $(SourceSwitch)myframe_app.cpp $(CmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/myframe_app$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/myframe_app$(ObjectSuffix).d:
@$(CompilerName) $(CmpOptions) $(IncludePath) -MT$(IntermediateDirectory)/myframe_app$(ObjectSuffix) -MF$(IntermediateDirectory)/myframe_app$(ObjectSuffix).d -MM myframe_app.cpp

$(IntermediateDirectory)/myframe_frame$(ObjectSuffix): myframe_frame.cpp $(IntermediateDirectory)/myframe_frame$(ObjectSuffix).d
$(CompilerName) $(SourceSwitch)myframe_frame.cpp $(CmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/myframe_frame$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/myframe_frame$(ObjectSuffix).d:
@$(CompilerName) $(CmpOptions) $(IncludePath) -MT$(IntermediateDirectory)/myframe_frame$(ObjectSuffix) -MF$(IntermediateDirectory)/myframe_frame$(ObjectSuffix).d -MM myframe_frame.cpp

##
## Clean
##
clean:
$(RM) $(IntermediateDirectory)/myframe_app$(ObjectSuffix)
$(RM) $(IntermediateDirectory)/myframe_app$(ObjectSuffix).d
$(RM) $(IntermediateDirectory)/myframe_frame$(ObjectSuffix)
$(RM) $(IntermediateDirectory)/myframe_frame$(ObjectSuffix).d
$(RM) $(OutputFile)
$(RM) $(OutputFile).exe

-include $(IntermediateDirectory)/*.d
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compile and run a wxWidget project

Post by eranif »

kea_ wrote:But I don't know where and how I should set the path to the wxWidget library.
You dont need to. Since CodeLite already set it for you. It is using :

Code: Select all

wx-config --cxxflags --unicode=yes --debug=yes
for the include path, defines and other settings.

and:

Code: Select all

wx-config --debug=yes --libs --unicode=yes
for the libraries / paths

kea_ wrote:cc1plus.exe: error: unrecognized command line option "-Wno-attributes"
Do you have another wx-config installed? since the one I am providing does not yield this option. and it seems like wx-config --cflags adds this option on your machine.

Here is the output on my XP machine:

Code: Select all

C:\>wx-config --cflags
-mthreads -DHAVE_W32API_H -D__WXMSW__ -D_UNICODE -IC:\wxWidgets-2.8.7\lib\gcc_dll\mswu -IC:\wxWidgets-2.8.7\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0
can u try to run the same command from the command line?
CodeLite installs this under /path/to/codelite/wx-config.exe

You can run this command to see which wx-config is used:

Code: Select all

/path/to/codelite/which.exe wx-config

Eran
Make sure you have read the HOW TO POST thread
kea_
CodeLite Curious
Posts: 6
Joined: Tue Sep 23, 2008 10:07 am
Contact:

Re: Compile and run a wxWidget project

Post by kea_ »

Hello eranif,

thank you for your great help.
I have found a installation help on http://codelite.org/LiteEditor/Download. In my opinion this should be on the documentation site. Anyway...
I have done the installation description steps on the download.
Now it works. But I have to copy the wxmsw28ud_gcc_custom.dll to the .exe file.
Width the wxdevcpp you can just compile link and then you have just one file.
I think that must be possible with the codelite too.
Do you know how to do that?

Thanks very much for your help
kea_
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Compile and run a wxWidget project

Post by eranif »

kea_ wrote:n my opinion this should be on the documentation site.
Done
kea_ wrote:But I have to copy the wxmsw28ud_gcc_custom.dll to the .exe file.
This is because you are using DLL build of wxWidgets. If you wish to have only exe, and no DLL, build wxWidgets as static library - please refer to http://wxforum.shadonet.com for more help about this.

Eran
Make sure you have read the HOW TO POST thread
kea_
CodeLite Curious
Posts: 6
Joined: Tue Sep 23, 2008 10:07 am
Contact:

Re: Compile and run a wxWidget project

Post by kea_ »

Hello Eran,

thank you for your great help.
Everything works fine now.

Greetings kea_
Post Reply