Sojourn

Still a Long Way To Go

  • Home
  • About

8

Jul

Error LNK2019 Saat Mengcompile DirectX pada Visual C++ 2008

Posted by ulimhd  Published in Game Programming, Tutorial, Visual Studio 2008

Akhirnya masuk juga ke pembahasan tentang DirectX, setelah sebelumnya berkutat dengan GDI dan kawan-kawannya.

Problem pertama yang saya temui ketika akan meng-compile source code adalah munculnya pesan error berikut:

error LNK2019: unresolved external symbol _DirectDrawCreateEx@16 referenced in function “int __cdecl Game_Init(void *,int)” (?Game_Init@@YAHPAXH@Z)

Seperti biasa, untuk memecahkan masalah ini, Google sangat membantu.

Ternyata link error ini karena saya belum memasukkan library dari DirectX ke dalam project. Untuk memasukkan library DirectX, yang perlu dilakukan adalah menambahkan folder library tersebut pada directory yang ada pada menu Tools >> Options >> Projects and Solutions >> VC++ Directories >> Show Directories for Library.

Directory library dari DirectX ini biasanya terletak pada Program Files\Microsoft DirectX SDK\Lib

Jangan lupa tambahkan juga folder Include. Terus terang saya belum tau efeknya apabila folder ini tidak dimasukkan.

Setelah itu, pada menu Project >> Properties >> Configuration Properties >> Input >> Additional Dependencies, masukkan 3 buah library ini: dxguid.lib ddraw.lib dinput8.lib

Compile ulang. Seharusnya setelah langkah-langkah di atas dijalani, error yang tadi tidak akan muncul lagi.

Silakan download source code-nya disini.

Tags: C/C++, Game Programming

no comment

30

Jun

Error C2065

Posted by ulimhd  Published in Game Programming, Visual Studio 2008

This is the first time I ever use the “cout” command in my codes. I always use “printf” rather than “cout”, nothing special, just the habits of using old C language.

Anyway, I try to compile this simple program using the “cout”, but it return an error like this:

error C2065: ‘cout’ : undeclared identifier

To me, it’s weird. As far as I know, “cout” is a standard command, adding the right header file (the “iostream”, that is) should make this command work. Hey, what do you know, in C++ to use this command (and other standard commands), I have to add this line after defining header files:

using namespace std;

Hm…

Still need lots of studies to master this language…

Tags: C/C++

no comment

17

Jun

Error Compiling iostream.h di Visual C++ 2008

Posted by ulimhd  Published in Tutorial, Visual Studio 2008

Sewaku mencoba meng-compile prototype Game di Visual C++ 2008 Express Edition ini, muncul error seperti ini:

error C2440: ‘=’ : cannot convert from ‘const char [10]‘ to ‘LPCWSTR’

padahal error ini ga muncul di Visual C++ 6.

Akhirnya kembali berpaling ke Google. Di suatu situs dijelaskan karena project yang dibangun ini menggunakan Character Set tipe Unicode yang seharusnya Multi-Byte. Solusinya, masuk ke menu project properties lewat Project >> Properties. Pilih menu General, seperti yang terlihat pada gambar di bawah ini.

Re-compile dengan tombol F7. Seharusnya error itu ga muncul lagi.

no comment

16

Jun

New To Visual C++ 2008 Express Edition

Posted by ulimhd  Published in Tutorial, Visual Studio 2008

Just got back to Visual C++ 2008 Express Edition. I already installed it months ago but haven’t use it because it can not edit .rc file, you know, the file to build resources to your program.

I planned to use this version of Visual C++ from now on. Visual C++ 6 is very old, I’m afraid that my programs won’t work well in Vista if I keep using that version. As for the .rc issue, I’ll figure it out later.

The first issue I encounter in VC++ 2008 is it don’t recognize iostream.h . When I tried to build my program, an error occurred like this:

fatal error C1083: Cannot open include file: ‘iostream.h’: No such file or directory

After do some Google, I’ve found out that VC++ 2008 doesn’t support iostream.h anymore. They are now recognize it only as iostream (leave the .h extension).  So just put

#include <iostream>

and the error is gone!

Wondering what error will occurred again in this version changing process.

Tags: C++, Visual Studio

1 comment

Search Here

 

September 2010
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
27282930  

Recent Comments

  • suta on SMS 1717
  • suta on SMS 1717
  • dhika on Install MS-Office 2007 di Ubuntu 9.04
  • panji on Rubik’s Cube
  • Hcmsu on Tidak Bisa Mengaktifkan Visual Effect

Recent Posts

  • Rubik’s Cube
  • Cahaya Mata
  • Bandung Lagi Deh
  • Sekedarnya
  • EPL Joke

Categories

  • Bike
  • Blogsome
  • Chit Chat
  • Comic
  • Extra Post
  • Game Programming
  • General Info
  • Internet and Technology
  • Joke
  • That a Science?
  • Thought
  • Tutorial
  • Ubuntu
  • Uncategorized
  • Vista Stuff
  • Visual Studio 2008
  • Windows
  • Word of The Day

Blogroll

  • Documentation
  • Themes
  • WordPress Planet

Contributors

  • Words of A Mind

Friends

  • Achai
  • Deni Yulian
  • Detri
  • Effendi
  • Eric
  • Ericson
  • Nico
  • Sigit
  • Siti

Archives

  • March 2010
  • January 2010
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008

Recent Entries

  • Rubik’s Cube
  • Cahaya Mata
  • Bandung Lagi Deh
  • Sekedarnya
  • EPL Joke
  • Hujan di Pagi Hari
  • Akhirnya Koala Juga
  • Error Saat Menjalankan Perintah Configure
  • Unbounce di Googlegroups
  • Time to Upgrade?

Recent Comments

  • suta in SMS 1717
  • suta in SMS 1717
  • dhika in Install MS-Office 2007 di Ubuntu 9.04
  • panji in Rubik's Cube
  • Hcmsu in Tidak Bisa Mengaktifkan Visual Effect
  • aseta in Rubik's Cube
  • union in Verifikasi PayPal Tanpa Kartu Kredit
  • ulimhd in Rubik's Cube
  • siti in Rubik's Cube
  • ulimhd in Hati-hati Penipuan Produk Aowa
  • Random Selection of Posts

    • Trouble Partisi Hard Disk di Vista
    • Bandluxe C270 – Ubuntu Jaunty Problem: Solved!
    • 2009: Day 1 @ Work
    • UAC Parody
    • Kembali Bekerja
    • Regurgitation
    • Unlimited Internet Access by Indosat
© 2008 Sojourn is proudly powered by WordPress
Theme designed by Roam2Rome