1. Highlight the material you wanted commented out.
2. M-;
Repeat above on the same code to uncomment it all.
2. M-;
Repeat above on the same code to uncomment it all.
$ g++ -O2 -c *.cppNow, you need to do the linking. This part can be a bit tricky, and it will all be done in one command. For comparison, I'll first show you how I would normally link my code, using only dynamic linking:
$ g++ -O2 -o lusus_stack data.o lusus_stack.o \
lusus_stack_funcs.o lusus_fallingleaf.o \
lusus_explodinglogo.o lusus_stacktitle.o \
lusus_wstackgraphic.o -lXxf86vm -lclanApp \
-lclanCore -lclanDisplay -lclanSound -lclanVorbis \
-lfontconfig -lfreetype -lclanGDI
$ g++ data.o lusus_stack.o lusus_stack_funcs.o \You'll notice four elements here:
lusus_fallingleaf.o lusus_explodinglogo.o \
lusus_stacktitle.o lusus_wstackgraphic.o -o statapp \
libclanVorbis.a -lvorbis libclanSound.a -lasound \
libclanGDI.a libclanDisplay.a -lpng12 -ljpeg \
libclanApp.a libclanCore.a -lXxf86vm -lfontconfig \
-lpthread
$ ldd /usr/local/lib/libclanDisplay.so
linux-vdso.so.1 => (0x00007fff7bbff000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00007fd1174b5000)
libjpeg.so.7 => /usr/lib/libjpeg.so.7 (0x00007fd117277000)
libz.so.1 => /lib/libz.so.1 (0x00007fd117061000)
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/libstdc++.so.6 (0x00007fd116d5e000)
libm.so.6 => /lib/libm.so.6 (0x00007fd116ada000)
libc.so.6 => /lib/libc.so.6 (0x00007fd116785000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd117a5d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fd11656f000)
libclanDisplay.a(jpeg_provider.o): In function `CL_JPEGProvider::save(CL_PixelBuffer, CL_StringContainer<char, CL_StringReference<char, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, CL_VirtualDirectory&, int)':
/scratch/choward/ClanLib-2.0.4/Sources/Display/ImageProviders/jpeg_provider.cpp:114: undefined reference to `jpeg_std_error'
/scratch/choward/ClanLib-2.0.4/Sources/Display/ImageProviders/jpeg_provider.cpp:116: undefined reference to `jpeg_CreateCompress'
/scratch/choward/ClanLib-2.0.4/Sources/Display/ImageProviders/jpeg_provider.cpp:137: undefined reference to `jpeg_stdio_dest'
/scratch/choward/ClanLib-2.0.4/Sources/Display/ImageProviders/jpeg_provider.cpp:152: undefined reference to `jpeg_set_defaults'
/scratch/choward/ClanLib-2.0.4/Sources/Display/ImageProviders/jpeg_provider.cpp:156: undefined reference to `jpeg_set_quality'
...
getSubimage
public BufferedImage getSubimage(int x,
int y,
int w,
int h)
Returns a subimage defined by a specified rectangular region. The returned BufferedImage shares the same data array as the original image.
Parameters:
w - the width of the specified rectangular region
h - the height of the specified rectangular region
Returns:
a BufferedImage that is the subimage of this BufferedImage.
Throws:
RasterFormatException - if the specified area is not contained within this BufferedImage.
// *** Key.java ***What's wrong with this Java code? It won't compile:
interface Key {}
// *** Card.java ***
interface Card {}
// *** KeyCard.java ***
public class KeyCard implements Key, Card {}
// *** Door.java ***
public class Door
{
public void openWith(Key key) { System.out.println("Opened door with key"); }
public void openWith(Card card) { System.out.println("Opened door with card"); }
}
// *** Scenario.java ***
public class Scenario
{
public static void main(String[] args)
{
KeyCard keycard = new KeyCard();
Door door = new Door();
door.openWith(keycard);
}
}
$ javac Scenario.java
Scenario.java:15: reference to openWith is ambiguous, both method openWith(Key) in Door and method openWith(Card) in Door match
door.openWith(keycard);
^
1 error
// *** Scenario.java ***Now this compiles and runs:
public class Scenario
{
public static void main(String[] args)
{
KeyCard keycard = new KeyCard();
Door door = new Door();
Key key = keycard;
Card card = keycard;
door.openWith(key);
door.openWith(card);
}
}
$ javac Scenario.java
$ java Scenario
Opened door with key
Opened door with card
