Page 1 of 3

wxwidgets program can not link

Posted: Tue Mar 23, 2010 4:38 pm
by shelll
hi,
thirst thank you for the great IDE, that code lite is.

i have a problem with the latest CL 2.3.0.3833 with mingw 4.4.0 (binary package from sourceforge) on windows xp/7.

after installation my wxWidgets project does not link (i am using an older version of wxwidgets 2.9 from svn, compiled with mingw 4.4.0) with linker error "undefined reference to `WinMain@16'"
so i tried new wxwidgets project from CL's template and i get the same error. here is the complete buildlog

Code: Select all

----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "tesWX_wsp.mk""
----------Building project:[ tesWX - Debug ]----------
mingw32-make.exe[1]: Entering directory `M:/data/cppprojects/tesWX'
g++ -o ./Debug/tesWX  "-Le:/data/MinGW-4.4.0/lib/" "-Le:/data/libraries/wxWidgets-2008-05-06/lib/gcc_lib/" "-Le:/data/libraries/glew/bin/" "-Le:/data/libraries/boost_1_35_0/lib/" "-Le:/data/libraries/devil/lib/unicode/"  "-L."   -mwindows  -mthreads -Le:\data\libraries\wxWidgets-2008-05-06\lib\gcc_dll -lwxmsw29ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 
e:/data/MinGW-4.4.0/lib//libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/tesWX] Error 1
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `M:/data/cppprojects/tesWX'
----------Build Ended----------
0 errors, 0 warnings
older CL 2.2.03681 (with the same mingw and wxwidgets) does not have this problem.

any idea where could be the error? any missing library that i should link or a linker switch?
thank you

Re: wxwidgets program can not link

Posted: Tue Mar 23, 2010 6:16 pm
by eranif
Try renaming the file main.c into main.cpp

Eran

Re: wxwidgets program can not link

Posted: Tue Mar 23, 2010 8:00 pm
by shelll
the file is named main.cpp, there is no main.c.

funny thing is that the very same line e:/data/MinGW-4.4.0/lib//libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain@16' apears in my older wx project and there is no main.c, nor main.cpp.

in the build log i do not even see a compilation of the main.cpp.

Re: wxwidgets program can not link

Posted: Tue Mar 23, 2010 9:16 pm
by eranif
Can u post the generated makefiles (tesWX_wsp.mk + tesWX.mk - 2 makefiles)

Did u try to re-build?
Eran

Re: wxwidgets program can not link

Posted: Tue Mar 23, 2010 10:30 pm
by shelll
rebuild does not help. here is the whole project with source code and makefiles

Re: wxwidgets program can not link

Posted: Wed Mar 24, 2010 8:56 am
by eranif
Well, it works here.

Do you see that main.cpp is being compiled?

Can you post here the output of the 're-build'?
Eran

Re: wxwidgets program can not link

Posted: Wed Mar 24, 2010 8:36 pm
by shelll
the rebuild log looks almost the same

Code: Select all

----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "tesWX.mk"  all"
----------Building project:[ tesWX - Debug ]----------
g++ -o ./Debug/tesWX.exe  "-Le:/data/MinGW-4.4.0/lib/" "-Le:/data/libraries/wxWidgets-2008-05-06/lib/gcc_lib/" "-Le:/data/libraries/glew/bin/" "-Le:/data/libraries/boost_1_35_0/lib/" "-Le:/data/libraries/devil/lib/unicode/"  "-L."   -mwindows  -mthreads -Le:\data\libraries\wxWidgets-2008-05-06\lib\gcc_dll -lwxmsw29ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 
e:/data/MinGW-4.4.0/lib//libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
mingw32-make.exe: *** [Debug/tesWX.exe] Error 1
----------Build Ended----------
0 errors, 0 warnings
the 'clean' part of the rebuild log is deleted after the build starts...

i tried to make a simple console application from template and it does not compile neither. the g++ says "no input file"

Code: Select all

----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "testCon.mk"  all"
----------Building project:[ testCon - Debug ]----------
g++ -o ./Debug/testCon  "-Le:/data/MinGW-4.4.0/lib/" "-Le:/data/libraries/wxWidgets-2008-05-06/lib/gcc_lib/" "-Le:/data/libraries/glew/bin/" "-Le:/data/libraries/boost_1_35_0/lib/" "-Le:/data/libraries/devil/lib/unicode/"  "-L."   
g++: no input files
mingw32-make.exe: *** [Debug/testCon] Error 1
----------Build Ended----------
0 errors, 0 warnings
attached file is the source, project and make files of the "hello world" console application

Re: wxwidgets program can not link

Posted: Wed Mar 24, 2010 9:07 pm
by frank_frl
Hi Shell,

your console app compiles fine here

Code: Select all

----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "testCon_wsp.mk""
----------Building project:[ testCon - Release ]----------
mingw32-make.exe[1]: Entering directory `G:/tmp/TestCon'
g++ -c  "G:/tmp/TestCon/main.cpp"  -o ./Release/main.o "-IE:/wxWidgets-2.8.10/include" "-IE:/WxWindows/projects_gnu/MyLibs/include"  "-I." "-I." 
g++ -o ./Release/testCon ./Release/main.o  "-LE:/WxWindows/projects_gnu/MyLibs/lib"  "-L."   -O2
mingw32-make.exe[1]: Leaving directory `G:/tmp/TestCon'
----------Build Ended----------
0 errors, 0 warnings
I'm missing the 'g++ -c' line in all your build output, so it looks like only the linker is called, but not the compiler.
Could you show us the generated makefile 'testCon.mk'

Frank

Re: wxwidgets program can not link

Posted: Wed Mar 24, 2010 11:48 pm
by eranif
Shell,

I posted this yesterday:
eranif wrote:Can u post the generated makefiles (tesWX_wsp.mk + tesWX.mk - 2 makefiles)
If you want help, please post here the generated makefile, since it seems to work on everyones computers but yours.

Looking at the makefile may give us a clue as why is the compile stage is not performed on your machine (like Frank mentioned, there is no 'g++ -c main.cpp ...')


Eran

Re: wxwidgets program can not link

Posted: Thu Mar 25, 2010 11:32 am
by shelll
all generated make files are included in those zip archives...

here is the testCon.mk

Code: Select all

##
## Auto Generated makefile by CodeLite IDE
## any manual changes will be erased      
##
## Debug
ProjectName            :=testCon
ConfigurationName      :=Debug
IntermediateDirectory  :=./Debug
OutDir                 := $(IntermediateDirectory)
WorkspacePath          := "M:\data\cppprojects\testCon"
ProjectPath            := "M:\data\cppprojects\testCon"
CurrentFileName        :=
CurrentFilePath        :=
CurrentFileFullPath    :=
User                   :=mato
Date                   :=03/24/10
CodeLitePath           :="e:\Program Files\CodeLite"
LinkerName             :=g++
ArchiveTool            :=ar rcus
SharedObjectLinkerName :=g++ -shared -fPIC
ObjectSuffix           :=.o
DependSuffix           :=.o.d
PreprocessSuffix       :=
DebugSwitch            :=-gstab
IncludeSwitch          :=-I
LibrarySwitch          :=-l
OutputSwitch           :=-o 
LibraryPathSwitch      :=-L
PreprocessorSwitch     :=-D
SourceSwitch           :=-c 
CompilerName           :=g++
C_CompilerName         :=gcc
OutputFile             :=$(IntermediateDirectory)/$(ProjectName)
Preprocessors          :=
ObjectSwitch           :=-o 
ArchiveOutputSwitch    := 
PreprocessOnlySwitch   :=
MakeDirCommand         :=makedir
CmpOptions             := -g $(Preprocessors)
LinkOptions            :=  
IncludePath            := "$(IncludeSwitch)e:/data/MinGW-4.4.0/include/" "$(IncludeSwitch)e:/data/libraries/wxWidgets-2008-05-06/include/" "$(IncludeSwitch)e:/data/libraries/glew/include/" "$(IncludeSwitch)e:/data/libraries/boost_1_35_0/include/" "$(IncludeSwitch)e:/data/libraries/devil/include/"  "$(IncludeSwitch)." "$(IncludeSwitch)." 
RcIncludePath          :=
Libs                   :=
LibPath                :="$(LibraryPathSwitch)e:/data/MinGW-4.4.0/lib/" "$(LibraryPathSwitch)e:/data/libraries/wxWidgets-2008-05-06/lib/gcc_lib/" "$(LibraryPathSwitch)e:/data/libraries/glew/bin/" "$(LibraryPathSwitch)e:/data/libraries/boost_1_35_0/lib/" "$(LibraryPathSwitch)e:/data/libraries/devil/lib/unicode/"  "$(LibraryPathSwitch)." 


##
## User defined environment variables
##
PATH:=e:\program files\CodeLite\;$(PATH)
SHELL:=CMD.EXE
UNIT_TEST_PP_SRC_DIR:=e:\data\UnitTest++-1.3
WXCFG:=gcc_dll\mswu
WXWIN:=e:\data\libraries\wxWidgets-2008-05-06\
Objects=$(IntermediateDirectory)/main$(ObjectSuffix) 

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

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

makeDirStep:
	@$(MakeDirCommand) "./Debug"

PreBuild:


##
## Objects
##
$(IntermediateDirectory)/main$(ObjectSuffix): main.cpp $(IntermediateDirectory)/main$(DependSuffix)
	@$(MakeDirCommand) "./Debug"
	$(CompilerName) $(SourceSwitch) "M:/data/cppprojects/testCon/main.cpp" $(CmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/main$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/main$(DependSuffix): main.cpp
	@$(MakeDirCommand) "./Debug"
	@$(CompilerName) $(CmpOptions) $(IncludePath) -MT$(IntermediateDirectory)/main$(ObjectSuffix) -MF$(IntermediateDirectory)/main$(DependSuffix) -MM "M:/data/cppprojects/testCon/main.cpp"


-include $(IntermediateDirectory)/*$(DependSuffix)
##
## Clean
##
clean:
	$(RM) $(IntermediateDirectory)/main$(ObjectSuffix)
	$(RM) $(IntermediateDirectory)/main$(DependSuffix)
	$(RM) $(IntermediateDirectory)/main$(PreprocessSuffix)
	$(RM) $(OutputFile)
	$(RM) $(OutputFile).exe