|
-
Dec 23rd, 2001, 02:31 PM
#1
Thread Starter
Lively Member
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?
-
Dec 23rd, 2001, 02:42 PM
#2
Monday Morning Lunatic
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
-
Dec 23rd, 2001, 02:58 PM
#3
Thread Starter
Lively Member
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?
-
Dec 23rd, 2001, 03:16 PM
#4
Monday Morning Lunatic
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
-
Dec 23rd, 2001, 03:53 PM
#5
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|