You are on page 1of 2

KL1164 Programming Language Semester 2, 2012/2013 Guide to include header and/or class files into your program In Visual

l C++

1. Copy the files (e.g. entry.h & entry.cpp) to same folder as the main file (e.g. db.cpp) 2. Right click on Source Files Add Existing Item then choose entry.cpp 3. Do the same for Header Files to add entry.h 4. Once the files are added, you can use #include & use any functions from the files in the main program.

Compilation: 1. First choose one file (e.g. db.cpp), then from the menu: Build Compile 2. Repeat for the main file (e.g. entry.cpp) 3. Once both files are compiled, you can then choose from the menu: Build Build Solution

In Netbeans (Java):

1.

2.

3.

Right click on your Source Package e.g. javaarraycalc, then choose New Java Class and write the name of the class to be included e.g. md_java Once the new java class has been create (e.g. md_java.java), click on it and copy paste from same file provided You can now use the class from the file provided.

Compilation: 1. First choose one file (e.g. md_java.java), then from the menu: Run Compile File 2. Repeat for the main file (e.g. JavaArrayCalc.java) 3. Once both files are compiled, you can then choose from the menu: Run Build Project (in Netbeans you should not be required to repeat steps 1 & 2 after this, Compile File is not available & you can directly choose Build Project)

You might also like