0

i was thinking if it was possible to separately write programs and then use it in a single program
my idea was to make a program for storing profiles and another program for game logic,..
and then combine it ( or use it ) into a single program

Profile.cpp --------- bridge.cpp-------------game.cpp

where bridge will be used to access (and display )both the cpps

  • 1
    You probably want to take a look at [C++ Dynamic Shared Libraries](http://stackoverflow.com/questions/496664/c-dynamic-shared-library-on-linux). – netcoder Sep 03 '12 at 17:16
  • @ netcoder if u can provide me a basic documentation or tutorial it would be great... i am just a beginner – Siddhartha Sinha Sep 03 '12 at 17:19
  • 2
    I don't do in tutorials. If you want to use dynamic linking, learn C++ first. – netcoder Sep 03 '12 at 17:20
  • ok! i will search up dynamic linking – Siddhartha Sinha Sep 03 '12 at 17:25
  • 1
    When you learn a new technology, it is wise to start with the simplest example you can find. Programmers speak of "Hello World", the simplest program that works and does something, as the ideal first project. You should write a simple C++ program, `main()` and two other functions, verify that it works as intended, then split it into three source files ("bridge.cpp", "profile.cpp", "game.cpp") and try to compile and link them. Ideally you should use a simpler tool than turboC++ at first, but I'm sure the turboC++ docs describe this process. – Beta Sep 03 '12 at 17:35

1 Answers1

3

Yes, C++ supports separate compilation, so you can write your program in pieces, in separate source files. You compile the files and link them together to create the executable file. The command line compiler can do it for you:

bcc bridge.cpp profile.cpp game.cpp
Pete Becker
  • 74,985
  • 8
  • 76
  • 165