Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to prevent a file from being opened? Pin
sundar15621-Sep-06 12:13
sundar15621-Sep-06 12:13 
QuestionDatabase connectivity Pin
sandeep_thakur21-Sep-06 10:48
sandeep_thakur21-Sep-06 10:48 
AnswerRe: Database connectivity Pin
Hamid_RT28-Sep-06 10:04
Hamid_RT28-Sep-06 10:04 
QuestionCould anyone help me try this example code Pin
bloodwinner21-Sep-06 10:41
bloodwinner21-Sep-06 10:41 
AnswerRe: Could anyone help me try this example code Pin
David Crow21-Sep-06 10:48
David Crow21-Sep-06 10:48 
AnswerRe: Could anyone help me try this example code Pin
bloodwinner21-Sep-06 11:00
bloodwinner21-Sep-06 11:00 
AnswerRe: Could anyone help me try this example code Pin
Hamid_RT21-Sep-06 18:29
Hamid_RT21-Sep-06 18:29 
QuestionWhat is wrong with this file? Pin
Lord Kixdemp21-Sep-06 10:37
Lord Kixdemp21-Sep-06 10:37 
Hello everyone!
OK, I've been making posts about this specific mother-freaking hair-greener problem, but now I got it just where I want it: I got it down to a 34-line file, no references to it in the rest of the program, just included once in my Includes.h file... Here it is:

// MapHandling.xxx: Handles maps.<br />
<br />
#ifndef _MAPHANDLING_H_<br />
#define _MAPHANDLING_H_<br />
<br />
namespace MapHandling<br />
{<br />
    struct TileFile<br />
    {<br />
        // Underground, Ground, Building Floor 2, and Building Floor 3<br />
        SDL_Surface *layers[4];<br />
<br />
        // TODO: Change to longer names!<br />
        int s, w, h;<br />
<br />
        TileFile() : s(0), w(0), h(0) {}<br />
<br />
        TileFile(int size, int w, int h, const std::string& filename) :<br />
            s(s), w(w), h(h)<br />
        {<br />
            layers[1] = IMG_Load(filename.c_str());<br />
<br />
            if (!layers[1])<br />
                exit(0);<br />
        }<br />
    } Tilesets[1];<br />
<br />
	void LoadTiles()<br />
	{<br />
		Tilesets[0] = TileFile(24, 3, 2, "./Graphics/Tiles.png");<br />
	}<br />
};<br />
<br />
#endif // _MAPHANDLING_H_


Note that the exact same thing happens on both VC++ 2005 and Code::Blocks. (Different error messages, of course, but same idea)
These are the VC++ errors:

1>------ Build started: Project: War Game, Configuration: Release Win32 ------<br />
1>Compiling...<br />
1>Player.cpp<br />
1>Main.cpp<br />
1>HelperFuncs.cpp<br />
1>Game.cpp<br />
1>Generating Code...<br />
1>Linking...<br />
1>HelperFuncs.obj : error LNK2005: "void __cdecl MapHandling::LoadTiles(void)" (?LoadTiles@MapHandling@@YAXXZ) already defined in Game.obj<br />
1>HelperFuncs.obj : error LNK2005: "struct MapHandling::TileFile * MapHandling::Tilesets" (?Tilesets@MapHandling@@3PAUTileFile@1@A) already defined in Game.obj<br />
1>Main.obj : error LNK2005: "void __cdecl MapHandling::LoadTiles(void)" (?LoadTiles@MapHandling@@YAXXZ) already defined in Game.obj<br />
1>Main.obj : error LNK2005: "struct MapHandling::TileFile * MapHandling::Tilesets" (?Tilesets@MapHandling@@3PAUTileFile@1@A) already defined in Game.obj<br />
1>Player.obj : error LNK2005: "void __cdecl MapHandling::LoadTiles(void)" (?LoadTiles@MapHandling@@YAXXZ) already defined in Game.obj<br />
1>Player.obj : error LNK2005: "struct MapHandling::TileFile * MapHandling::Tilesets" (?Tilesets@MapHandling@@3PAUTileFile@1@A) already defined in Game.obj<br />
1>..\Release/War Game.exe : fatal error LNK1169: one or more multiply defined symbols found<br />
1>Build log was saved at "file://c:\Incoming\War Game\Visual Studio 2005\Release\BuildLog.htm"<br />
1>War Game - 7 error(s), 0 warning(s)<br />
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


If I remove the #include to this file, it compiles zezw. (Zero Errors, Zero Warnings).
Can anyone tell me what's the problem? I have another file that does the same thing, so I'll post it if needed... Thanks! Wink | ;)

Windows Calculator told me I will die at 28. Frown | :(

AnswerRe: What is wrong with this file? (It's going down now) Pin
Lord Kixdemp21-Sep-06 11:09
Lord Kixdemp21-Sep-06 11:09 
QuestionVisual C++ Express Edition Pin
su_penguin21-Sep-06 9:58
su_penguin21-Sep-06 9:58 
AnswerRe: Visual C++ Express Edition Pin
Christian Graus21-Sep-06 10:43
protectorChristian Graus21-Sep-06 10:43 
QuestionAccess Violation? Pin
BlackDice21-Sep-06 9:33
BlackDice21-Sep-06 9:33 
AnswerRe: Access Violation? Pin
Chris Losinger21-Sep-06 9:47
professionalChris Losinger21-Sep-06 9:47 
AnswerRe: Access Violation? Pin
Jörgen Sigvardsson21-Sep-06 9:50
Jörgen Sigvardsson21-Sep-06 9:50 
AnswerDoh!! Pin
BlackDice21-Sep-06 10:06
BlackDice21-Sep-06 10:06 
QuestionHow I can get the text from x,y coordinate? Pin
Marco225021-Sep-06 7:06
Marco225021-Sep-06 7:06 
AnswerRe: How I can get the text from x,y coordinate? Pin
Chris Losinger21-Sep-06 7:12
professionalChris Losinger21-Sep-06 7:12 
GeneralRe: How I can get the text from x,y coordinate? Pin
led mike21-Sep-06 7:53
led mike21-Sep-06 7:53 
GeneralRe: How I can get the text from x,y coordinate? Pin
Chris Losinger21-Sep-06 7:57
professionalChris Losinger21-Sep-06 7:57 
GeneralRe: How I can get the text from x,y coordinate? Pin
led mike21-Sep-06 8:02
led mike21-Sep-06 8:02 
GeneralRe: How I can get the text from x,y coordinate? Pin
Chris Losinger21-Sep-06 8:09
professionalChris Losinger21-Sep-06 8:09 
GeneralRe: How I can get the text from x,y coordinate? Pin
Stephen Hewitt21-Sep-06 15:58
Stephen Hewitt21-Sep-06 15:58 
AnswerRe: How I can get the text from x,y coordinate? Pin
led mike21-Sep-06 8:06
led mike21-Sep-06 8:06 
QuestionThreads in vc++.net 1.1 Pin
sandeep_thakur21-Sep-06 7:05
sandeep_thakur21-Sep-06 7:05 
AnswerRe: Threads in vc++.net 1.1 Pin
led mike21-Sep-06 7:54
led mike21-Sep-06 7:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.