![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Makefile problem - How to run module load in a Makefile | hernandinho | UNIX for Advanced & Expert Users | 2 | 04-13-2009 11:20 AM |
| Makefile | myle | High Level Programming | 0 | 07-02-2008 10:52 AM |
| Makefile | NamrataGurav | High Level Programming | 7 | 10-07-2006 03:29 PM |
| about the makefile | ligerdave | High Level Programming | 2 | 01-31-2006 01:21 AM |
| makefile | ECBROWN | UNIX for Dummies Questions & Answers | 4 | 02-17-2005 12:01 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Makefile help
I've copied a C++ project from my old computer to this one, and I am now trying to (without success) compile the project in the same way as I did before. I use Emacs as a text editor and compile with g++. Here is what my makefile looks like: Code:
CC=g++
CPPFLAGS=-Wall
CPPFLAGS+=-I..
CPPFLAGS+=-lmingw32 -lSDLmain -lSDL
CPPFLAGS+=-mwindows
SRC=main.cpp #../imanip/imanip.cpp #../imanip/imfuncs.cpp
OBJ=$(SRC:.cpp=.o)
OUT=image_test.exe
all: $(OUT)
rm $(OBJ) #Remove .o
$(OBJ) :
$(CC) $(SRC) $(CPPFLAGS) -c #Create .o
$(OUT) : $(OBJ)
$(CC) $(OBJ) $(CPPFLAGS) -o $@ #Link .
And here is what Emacs displays when trying to compile (Edit: just ignore this error and skip down to my second post, since this error was caused by an incorrect installation of SDL!): Code:
mingw32-make -k g++ main.o -Wall -I.. -lmingw32 -lSDLmain -lSDL -mwindows -o image_test.exe C:\Program1\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lSDLmain collect2: ld returned 1 exit status mingw32-make: *** [image_test.exe] Error 1 mingw32-make: Target `all' not remade because of errors. It says that it can't find -lSDLmain. What does it mean (makefiles are not my strong side), I have installed SDL the way it should be installed (NOT!)? Can you see what is wrong? Last edited by TriKri; 09-24-2009 at 03:03 AM.. |
|
||||
|
Sorry, I just realized that SDL was causing that problem, since I copied the wrong folder by mistake when installing SDL development package (bin folder instead of lib). Anyway, I corrected that, and that error disappeared. However, I got this error instead: Code:
mingw32-make -k g++ main.o -Wall -I.. -lmingw32 -lSDLmain -lSDL -mwindows -o image_test.exe #Link . g++: #Link: No such file or directory mingw32-make: *** [image_test.exe] Error 1 mingw32-make: Target `all' not remade because of errors. Looks like it has problems with the comment? Why? Shouldn't it totally ignore the comment? Once again, I am a newbie when it comes to makefiles, this one I basically just tried to mimic from an already existing makefile from another project! Edit: The strange this is that, if I remove the comment "#Link .", it DOES compile, but it leaves the following message: Code:
mingw32-make -k rm main.o #Remove .o process_begin: CreateProcess(NULL, rm main.o #Remove .o, ...) failed. make (e=2): The system cannot find the file specified. mingw32-make: *** [all] Error 2 CreateProcess failed? And "make (e=2): The system cannot find the file specified", what does this mean? ---------- Post updated at 08:39 AM ---------- Previous update was at 07:57 AM ---------- Now I got it! I'm not programming in Unix/Linux actually, I'm programming in Windows, using mingw. What I forgot is that rm in not a normal windows shell command. I had to install msys! When I installed it and added the bin folder to my path in windows, everything worked perfectly well! Last edited by TriKri; 09-24-2009 at 03:22 AM.. |
|
||||
|
Quote:
Cited from Tutorial - Makefile: some makefile statement # a comment |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|