OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

> How To Use Multiple .cpp Files?
Capn_Fish
post Aug 19 2007, 04:07 PM
Post #1





Group: Members
Posts: 2,352
Joined: 30-July 06
Member No.: 10,575



I'm starting to hopefully code a game for the Z, but I need to put stuff not only in multiple .hpp files but also in .cpp files. Does anybody have a good link for how to do this? My horrible searching skills failed to turn anything up.

Also, is there a good tutorial for using the autotools/makefiles? Those seem to be important to using multiple source files as well.

Thanks.
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
Capn_Fish
post Aug 19 2007, 06:01 PM
Post #2





Group: Members
Posts: 2,352
Joined: 30-July 06
Member No.: 10,575



Ah, that mostly clears it up. A couple of follow-up questions:

1. So I make a prototype function in the header ( void myfunction(int myint); ), then have the complete function in the .cpp file? (Yes, as it works)

2. How do I use automake if I don't have a configure.in or configure.ac file?

Thanks.

EDIT: I'm getting errors when I try to compile with the files like they are:

CODE
Fish LOZR # g++ lozr.cpp sprite.cpp screen.cpp input.cpp  -o lozr -lSDL -lSDL_image
lozr.cpp: In function 'int main(int, char**)':
lozr.cpp:42: warning: deprecated conversion from string constant to 'char*'
/tmp/ccXyIXFl.o:(.bss+0x0): multiple definition of `spriteMain'
/tmp/cc2NlQAW.o:(.bss+0x20): first defined here
/tmp/ccXyIXFl.o:(.bss+0x2c): multiple definition of `surfScreen'
/tmp/cc2NlQAW.o:(.bss+0x4c): first defined here
/tmp/ccEAhPKQ.o:(.bss+0x0): multiple definition of `surfScreen'
/tmp/cc2NlQAW.o:(.bss+0x4c): first defined here
/tmp/ccxIcIsw.o:(.bss+0x0): multiple definition of `myEvent'
/tmp/cc2NlQAW.o:(.bss+0x0): first defined here
collect2: ld returned 1 exit status
Fish LOZR #


What's wrong?

This post has been edited by Capn_Fish: Aug 19 2007, 06:44 PM
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 26th April 2015 - 03:33 AM