Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:10:44+00:00 2026-06-11T01:10:44+00:00

Still working on my game, and fir each difficulty I have a gameSpeed this

  • 0

Still working on my game, and fir each difficulty I have a “gameSpeed” this is set depending on the difficult chosen.

However when trying to run my application I get the following error:

duplicate symbol _gameSpeed in:
/Users/Ashley/Library/Developer/Xcode/DerivedData/Whack-etfeadnxmmtdkgdoyvgumsuaapsz/Build/Intermediates/Whack.build/Debug-iphonesimulator/Whack.build/Objects-normal/i386/TimedGameLayer.o
/Users/Ashley/Library/Developer/Xcode/DerivedData/Whack-etfeadnxmmtdkgdoyvgumsuaapsz/Build/Intermediates/Whack.build/Debug-iphonesimulator/Whack.build/Objects-normal/i386/GameInfo.o
ld: 1 duplicate symbols for architecture i386
collect2: ld returned 1 exit status
Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1

I am only using gameSpeed in one location.

which is here:

[self schedule:@selector(tryPopMoles:) interval:gameSpeed];

this is inside my TimedGameLayer.m

The gameSpeed var is in my GameInfo.h

I import the header like so:

#import "GameInfo.h"

My GameInfo.h looks like this:

@interface GameInfo : NSObject
+(void)setupGame:(enum GameType)type withArg2:(enum GameDifficulty)difficulty;
+(void)resetGame;
+(void)togglePause;

@end

//Game Type
enum GameType gameType;
enum GameDifficulty gameDifficulty;

//Release Version
NSString *version;

//Settings
int gameSpeed = 1.5;

//Stats
int touches = 0;
int score = 0;
int totalSpawns = 0;

//usables
bool gamePaused = FALSE;

typedef enum GameType {
    GameTypeClassic = 0,
    GameTypeUnlimited,
    GameTypeTimed,
    GameTypeExpert,
} GameType;

typedef enum GameDifficulty
{
    GameDifficultyEasy = 0,
    GameDifficultyMedium,
    GameDifficultyHard,
} GameDifficulty;

My setupGame function(which is in my GameInfo.m file) looks like this:

+(void)setupGame:(enum GameType)type withArg2:(enum GameDifficulty)difficulty
{
    gameType = type;
    gameDifficulty = difficulty;

    switch(gameDifficulty)
    {
        case GameDifficultyEasy:
            gameSpeed = 1.5;
            break;
        case GameDifficultyMedium:
            gameSpeed = 1.0;
            break;
        case GameDifficultyHard:
            gameSpeed = 0.5;
            break;
    }
}

Im completely lost here…

Any ideas?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:10:45+00:00Added an answer on June 11, 2026 at 1:10 am

    Based on your comments below and your example code:

    You have a series of variables declared in the .h file, and the .h file is included multiple times, so you have multiple variables with the same name. You should create a constants.h and constants.m file and declare that list as constants in the constants file.

    constants.h:
    extern const int gameSpeed;
    
    constants.m:
    const int gameSpeed = 1;
    

    By the way, you’re declaring gameSpeed as an int but assign a float value to it, so gameSpeed will be equal to 1. Use a float type instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to get this Sudoku game working, and I am still failing
Still working on lisp recipes and idioms. I have a list like this: ((a
I have written a simple, working tetris game with each block as an instance
I am working on a small game using webgl. Within this game I have
I am working on a game like Mafia Wars and i am trying to
I've been working on a 2d game in java recently, and am currently trying
I am working on a game in Android and I have Bitmap objects being
I have started working on a new Xcode project, a game to be exact.
I'm working on a multiplayer flash game. The server informs each client what other
I'm working on a state based game engine and have something I'm happy with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.