Results 1 to 5 of 5

Thread: Uresolved exernals:(

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80

    Uresolved exernals:(

    I have a main.cpp and a main.h. I have most of my ints/doubles in the main.h, and when I compile my main.cpp, it compiles fine. But when I try to run my program, I get this:

    --------------------Configuration: Maze - Win32 Debug--------------------
    Linking...
    Main.obj : error LNK2001: unresolved external symbol "double angle" (?angle@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double vectorz" (?vectorz@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double vectorx" (?vectorx@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double posx" (?posx@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double posz" (?posz@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double viewx" (?viewx@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double viewz" (?viewz@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double upx" (?upx@@3NA)
    Main.obj : error LNK2001: unresolved external symbol "double upz" (?upz@@3NA)
    Debug/Maze.exe : fatal error LNK1120: 9 unresolved externals
    Error executing link.exe.

    Anyone know whats wrong?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Are they global to the program, i.e. are they straight inside the .h file (not within a class or anything)?

    PS: You haven't even built the program yet since you can't run without linking.

    PPS: Try doing "Rebuild All" - that occasionally fixes symbol problems.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80
    Heres my .h file:

    #ifndef _MAIN_H
    #define _MAIN_H

    #include <windows.h>
    #include <gl/gl.h>
    #include <gl/glu.h>
    #include <gl/glaux.h>
    #include <math.h>

    extern double posx;
    extern double posy;
    extern double posz;

    extern double viewx;
    extern double viewy;
    extern double viewz;

    extern double upx;
    extern double upy;
    extern double upz;

    extern double vectorx;
    extern double vectory;
    extern double vectorz;

    extern double angle;

    #endif

    Does it help if they are in a class?

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Ah. Are they defined as non-externs in your .cpp file?

    What that does, is to define the symbols - however if they're not defined in an object file (i.e. the result of compiling a single .cpp file) then the linker can't find them.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Location
    2 miles from everywhere
    Posts
    80
    It works now Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width