Page 1 of 1

Can not compile

Posted: Fri Mar 14, 2008 4:21 am
by jin
Hey to test it out i tried to run the hello word program and it did not work i tries it with minGW and cygwin i got these errors

Code: Select all

#include "stdio.h"

int main ()
{
	printf ( "Hello world from LiteEditor\n" );
	return 0;
}
MINGW:
Building: "C:\MinGW\bin\mingw32-make.exe" -j 1 -f "a_wsp.mk" type=Debug
----------Building project:[ t1 - Debug ]----------
C:\MinGW\bin\mingw32-make.exe: not found
mingw32-make: *** [All] Error 127
----------Build Ended----------

CYGWIN:
Building: "C:\cygnus\cygwin-b20\cygnus.bat" -j 1 -f "a_wsp.mk" type=Debug
bash.exe: warning: could not find /tmp, please create!

please help

Re: Can not compile

Posted: Fri Mar 14, 2008 9:59 am
by eranif
Hi,
jin wrote:Building: "C:\MinGW\bin\mingw32-make.exe" -j 1 -f "a_wsp.mk" type=Debug
What happens if you open a command shell (Start -> Run -> cmd) and tries to run the same exact command?
Does it compile there?

Can u paste here the makefiles? (a_wsp.mk & t1.mk)
Eran

Re: Can not compile

Posted: Sat Mar 15, 2008 5:38 am
by jin
CYGWIN
a_wsp.mk

Code: Select all

.PHONY: clean All

All:
	@echo ----------Building project:[ t1 - Debug ]----------
	@"C:\cygnus\cygwin-b20\cygnus.bat"  -j 1 -f "t1.mk" type=Debug 
clean:
	@echo ----------Building project:[ t1 - Debug ]----------
	@"C:\cygnus\cygwin-b20\cygnus.bat"  -j 1 -f "t1.mk" type=Debug  clean
t1.mk

Code: Select all

##
## Auto Generated makefile, please do not edit
##
Path:=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%QUARTUS_ROOTDIR%\bin;;;C:\Program Files\CodeLite;C:\Program Files\CodeLite\bin;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin
TMP:=%USERPROFILE%\Local Settings\Temp
ProjectName:=t1

## Debug
ifeq ($(type),Debug)
ConfigurationName :=Debug
IntermediateDirectory :=./Debug
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)/$(ProjectName)d
Preprocessors :=
ObjectSwitch :=-o 
ArchiveOutputSwitch := 
CmpOptions :=-g $(Preprocessors)
LinkOptions := 
IncludePath := $(IncludeSwitch). 
RcIncludePath :=
Libs :=
LibPath :=
endif

Objects=$(IntermediateDirectory)/c$(ObjectSuffix) 

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

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

makeDirStep:
	@makedir "./Debug"


PreBuild:


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

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

-include $(IntermediateDirectory)/*.d
MINGW
a_wsp.mk

Code: Select all

.PHONY: clean All

All:
	@echo ----------Building project:[ t1 - Debug ]----------
	@"C:\MinGW\bin\mingw32-make.exe"  -j 1 -f "t1.mk" type=Debug 
clean:
	@echo ----------Building project:[ t1 - Debug ]----------
	@"C:\MinGW\bin\mingw32-make.exe"  -j 1 -f "t1.mk" type=Debug  clean
t1.mk

Code: Select all

##
## Auto Generated makefile, please do not edit
##
Path:=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%QUARTUS_ROOTDIR%\bin;;;C:\Program Files\CodeLite;C:\Program Files\CodeLite\bin;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin
TMP:=%USERPROFILE%\Local Settings\Temp
ProjectName:=t1

## Debug
ifeq ($(type),Debug)
ConfigurationName :=Debug
IntermediateDirectory :=./Debug
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)/$(ProjectName)d
Preprocessors :=
ObjectSwitch :=-o 
ArchiveOutputSwitch := 
CmpOptions :=-g $(Preprocessors)
LinkOptions := 
IncludePath := $(IncludeSwitch). 
RcIncludePath :=
Libs :=
LibPath :=
endif

Objects=$(IntermediateDirectory)/c$(ObjectSuffix) 

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

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

makeDirStep:
	@makedir "./Debug"


PreBuild:


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

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

-include $(IntermediateDirectory)/*.d

Re: Can not compile

Posted: Sat Mar 15, 2008 3:12 pm
by eranif
Hi,

I cant seem to reproduce it here.
Can you try to build it from the command line?

Start -> Run -> cmd
then then cd to the workspace directory, followed by:

Code: Select all

C:\MinGW\bin\mingw32-make.exe -j 1 -f "a_wsp.mk" type=Debug
Eran

Re: Can not compile

Posted: Sat Mar 15, 2008 9:51 pm
by jin
I still got the same errors as before

Re: Can not compile

Posted: Sat Mar 15, 2008 10:23 pm
by eranif
In your makefile, i see these lines:

Code: Select all

Path:=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%QUARTUS_ROOTDIR%\bin;;;C:\Program Files\CodeLite;C:\Program Files\CodeLite\bin;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin
TMP:=%USERPROFILE%\Local Settings\Temp
try to remove them and compile again from the command line.
Makefiles don't support %VARNAME% (the windows style, with '%'), so you should not copy the content of the variable to the 'Environment Variable' settings.
If you want to update your environment variable 'Path', you can simply do the following:

In the environment variables settings, create new variable, and fill:
Variable Name:Path
Variable Value:$(Path);C:\bla\bla

Eran

Re: Can not compile

Posted: Sun Mar 16, 2008 2:55 am
by jin
I did not create those files they were created by codelite, ill still try to modify them them and then compile, ill let you know what happens

Re: Can not compile

Posted: Sun Mar 16, 2008 10:42 am
by eranif
Hi Jin,

I know the makefiles were generated by codelite and not by you... this is not the point.
The thing is that the makefiles are generated based on data stored in the project, workspace & other settings one of them is the environment variable settings.

In order to remove these lines, you should do the following:
1. Go to 'Settings' menu and select 'Environment variables'
2. You should now see a dialog in front of you with a list of variables
3. Select the 'Path' variable, and press the 'Delete' button.
4. Do the same for the 'TMP' variable
5. Right click on your project and select 'Export makefile' (this step is important)
6. Build again

view the makefiles and confirm that the above lines were removed.
let me know how it goes

Eran

Re: Can not compile

Posted: Sun Mar 16, 2008 7:54 pm
by jin
Hey thanks a lot that was it.

One last question how would i go about building a programs with Makefiles:

the programs files are these
  • Main.cc
    squared.cc
    squared.h
    squareRoot.cc
    squareRoot.h
and this is my makefile

Code: Select all

Main:	Main.o squared.o squareRoot.o
	g++ Main.o squared.o squareRoot.o -o Main

Main.o:	Main.cc squared.h squareRoot.h
	g++ -c Main.cc

squared.o:	squared.cc squared.h
	g++ -c squared.cc

squareRoot.o:	squareRoot.cc squareRoot.h
	g++ -c squareRoot.cc
i know this seems like overdoing it for an easy program but i am working on a webserver whose makefile is like this:

Code: Select all

Main:	HTTPserver.o socket.o networkbuf.o netstream.o HTTPmessage.o HTTPrequest.o Log.o Access_Log.o Error_Log.o Debug_Log.o Config_File.o
	g++ *.o -o main -lnsl -lsocket

HTTPserver.o:	HTTPserver.C socket.H netstream.H HTTPrequest.H HTTPmessage.H Access_Log.H Config_File.H
	g++ -c HTTPserver.C

socket.o:	socket.C socket.H Error_Log.H
	g++ -c socket.C

networkbuf.o:	networkbuf.C networkbuf.H socket.H	
	g++ -c networkbuf.C

netstream.o:	netstream.C netstream.H socket.H networkbuf.H
	g++ -c netstream.C

HTTPmessage.o:		HTTPmessage.C HTTPmessage.H
	g++ -c HTTPmessage.C

HTTPrequest.o:		HTTPrequest.C HTTPrequest.H HTTPmessage.H Error_Log.H Debug_Log.H
	g++ -c HTTPrequest.C

Log.o:	Log.C Log.H
	g++ -c Log.C
	
Access_Log.o:	Access_Log.C Access_Log.H Log.H Config_File.H
	g++ -c Access_Log.C

Error_Log.o:	Error_Log.C Error_Log.H Log.H Config_File.H
	g++ -c Error_Log.C

Debug_Log.o:	Debug_Log.C Debug_Log.H Log.H Config_File.H
	g++ -c Debug_Log.C
	
Config_File.o:	Config_File.C Config_File.H
	g++ -c Config_File.C
	
clean:
	rm *.o main
and more still need to be done

Re: Can not compile

Posted: Sun Mar 16, 2008 11:32 pm
by eranif
jin wrote:One last question how would i go about building a programs with Makefiles:
I added new entry in the wiki that will answer your question for how to handle custom makefile with CodeLite:

http://codelite.org/wiki/pmwiki.php?n=L ... mMakefiles

Eran