Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Why on earth are my includes not working? Should be dirt-simple.

Author
Message
Merak Spielman
16
Years of Service
User Offline
Joined: 14th Jul 2008
Location:
Posted: 19th Mar 2010 19:43
I commented out all my code to verify it was just the #includes causing the problem.

I have 3 files.

Main.cpp

MG_Gamestate.h

MG_Gamestate.cpp


The idea being that the important variables about starting my game will be included in the Gamestate class, which I define in MG_Gamestate and code in MG_Gamestate.cpp.

This is pretty standard stuff, I'm mostly just messing around.

At this point, after commenting out the code, Main.cpp contains only the following:



MG_Gamestate.h contains only the following:


and MG_Gamestate.cpp contains the following:


That is IT. It is a completely blank program that does absolutely nothing.

But somehow the includes are messing it up. I figure it's trying to include something twice and getting confused, but I'm not sure what or where.

here is the error code:



Why isn't this working?



I'm running Visual C++ 2008 Express on Windows 7.
Merak Spielman
16
Years of Service
User Offline
Joined: 14th Jul 2008
Location:
Posted: 19th Mar 2010 19:54
I had previously followed the instructions in this thread:
http://forum.thegamecreators.com/?m=forum_view&t=167447&b=22

to get <string> to include properly. Could that somehow be the problem?
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 19th Mar 2010 20:52
remove #include "DarkGDK.h" from MG_gamestate.H

Add me to your MSN!
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 21st Mar 2010 14:02
#pragma once is a nifty thing to add at the top of your own include files to ensure that they are only included once. However, you should of course not need to include the same file twice, but it's easy enough that it happens.

haliop
User Banned
Posted: 21st Mar 2010 15:04
#PRAGMA ONCE
and
#ifndef #$%#$%_H
#define $%@#%^_H

do the same thing
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 21st Mar 2010 16:14


should be



Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 22nd Mar 2010 00:54
Have you excluded libcmt.lib and atls.lib from your project? in linker input? That should fix it


project/properties/configuration properties/linker/input/ignore specific library

hi
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 22nd Mar 2010 10:10 Edited at: 22nd Mar 2010 10:10
You don't need to include this line:



... in MG_Gamestate.cpp. It's already included in the header file. Otherwise, you should do what Hassan said and also change /MTd to /MT in the project properties.

I.e., under Configuration Properties, go to C/C++, then Code Generation and choose Multi-Threaded in place of Multi-Threaded Debug.

Login to post a reply

Server time is: 2024-10-02 03:33:40
Your offset time is: 2024-10-02 03:33:40