home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2754
Discussions: 188,382, Posts: 2,243,483, Members: 232,612
Old April 23rd, 2003, 08:18 PM   Digg it!   #1 (permalink)
Senior Member
 
squeech's Avatar
 
Join Date: May 2002
Location: Rocky Mountain High
Posts: 613
Angry
Stupid makefile!

Hello all,

I am trying to compile together a program using three files:
-Two files for a class called CPU (cpu.h and cpu.cpp)
-A driver file with the main function in it (driver.cpp)

This is my first attempt at writing my own makefile for an abstract data type like this so forgive the maturity level, but here is the makefile I had written for this program:
Code:
# Makefile for the CPU overclocking program

 CXX = g++
 CXXFLAGS = -g -c
 LD = g++

 ocsim: cpu.o driver.o
 ${LD} cpu.o driver.o -o ocsim

 cpu.o: cpu.h cpu.cpp
 ${CXX} ${CXXFLAGS} cpu.cpp

 driver.o: driver cpu.h
 ${CXX} ${CXXFLAGS} driver.cpp

 clean:
 rm -rf ocsim *.o core
I want to use the g++ compiler and the executable to be named "ocsim". when I try to run make with this file I get an error that states:

"Makefile:n: *** missing separator. Stop."

Where "n" is a number that varies each time I try the command.

Any help is GREATLY appreciated!

squeech is offline   Reply With Quote
Old April 23rd, 2003, 09:19 PM     #2 (permalink)
Member
 
Join Date: Feb 2002
Posts: 161
One rather annoying thing about makefiles is that there are certain places where you _must_ use tabs, not spaces. So the lines
Code:
ocsim: cpu.o driver.o
${LD} cpu.o driver.o -o ocsim
must be written as
Code:
ocsim: cpu.o driver.o
(TAB GOES HERE!!!)${LD} cpu.o driver.o -o ocsim
... replacing the obvious text with a tab. The same thing applies to the other rules. Also, in your rule for driver.o, I think you want to say 'driver.cpp', and not 'driver'.

Martee is offline   Reply With Quote
Old April 23rd, 2003, 09:35 PM     #3 (permalink)
Senior Member
 
squeech's Avatar
 
Join Date: May 2002
Location: Rocky Mountain High
Posts: 613
Aha! That is slightly annoying.

However, I can tell you that I'll never forget it after that!

You were right about the driver.o rule, thanks for catchin' that.
__________________
Talking in numbers doesn't make you smarter.

squeech is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2888)
The United States Debt (20)
Looks like Burris will get his Sena.. (8)
I think I just killed my computer w.. (24)
Upgrading RAM (5)
hp compaq nc6000 problems (138)
Folderchat Weekday thread (440)
Antec 300 bulk purchase? (11)
Help with an Ati Radeon HD 4850 512.. (27)
Recent Discussions
Folderchat Weekday thread (440)
How to increase my ram? (5)
Building a gaming computer advi.. (2)
Help with an Ati Radeon HD 4850.. (27)
CPU wont boot (4)
2nd video card (1)
special characters in quarkxpre.. (3)
Need help removing my front usb.. (2)
Genuine Broadband Connection my.. (14)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 09:26 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28