ivanforum ivanforum
Forum for Iter Vehemens ad Necem
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   fchat fChat   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Code Compilation
Goto page 1, 2  Next
 
Post new topic   Reply to topic    ivanforum Forum Index -> Programming
View previous topic :: View next topic  
Author Message
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Wed Apr 06, 2005 1:21 am    Post subject: Code Compilation Reply with quote

This is frustrating me to no end. I know it's something simple, but I just can't get it. I'm sure I'll figure it out as soon as I actually get some sleep, but until then... Help! :P

Anyways, I'm attempting to get the code to compile in Microsoft Visual Studio 6 (.NET doesn't like the code too much, and I prefer VS over other compilers. Still not completely sure why.), and I keep getting these linking errors:

Linking...
charset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl databasecreator<class character>::InstallDataBase(class character *,int)" (?InstallDataBase@?$databasecreator@Vcharacter@@@@SAXPAVcharacter@@H@Z)
charset.obj : error LNK2001: unresolved external symbol "public: static int __cdecl databasecreator<class character>::CreateDivineConfigurations(class characterprototype const *,struct characterdatabase * *,int)" (?CreateDivineConfigurations@?$datab
asecreator@Vcharacter@@@@SAHPBVcharacterprototype@@PAPAUcharacterdatabase@@H@Z)
charsset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl databasecreator<class character>::FindDataBase(struct characterdatabase const * &,class characterprototype const *,int)" (?FindDataBase@?$databasecreator@Vcharacte
r@@@@SAXAAPBUcharacterdatabase@@PBVcharacterprototype@@H@Z)
itemset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl databasecreator<class item>::InstallDataBase(class item *,int)" (?InstallDataBase@?$databasecreator@Vitem@@@@SAXPAVitem@@H@Z)
itemset.obj : error LNK2001: unresolved external symbol "public: static int __cdecl databasecreator<class item>::CreateDivineConfigurations(class itemprototype const *,struct itemdatabase * *,int)" (?CreateDivineConfigurations@?$databasecreator@Vite
m@@@@SAHPBVitemprototype@@PAPAUitemdatabase@@H@Z)
levelset.obj : error LNK2001: unresolved external symbol "protected: class glterrain * __thiscall contentscripttemplate<class glterrain>::BasicInstantiate(int)const " (?BasicInstantiate@?$contentscripttemplate@Vglterrain@@@@IBEPAVglterrain@@H@Z)
levelset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl databasecreator<class olterrain>::InstallDataBase(class olterrain *,int)" (?InstallDataBase@?$databasecreator@Volterrain@@@@SAXPAVolterrain@@H@Z)
levelset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl databasecreator<class glterrain>::InstallDataBase(class glterrain *,int)" (?InstallDataBase@?$databasecreator@Vglterrain@@@@SAXPAVglterrain@@H@Z)
levelset.obj : error LNK2001: unresolved external symbol "public: static int __cdecl databasecreator<class olterrain>::CreateDivineConfigurations(class olterrainprototype const *,struct olterraindatabase * *,int)" (?CreateDivineConfigurations@?$data
basecreator@Volterrain@@@@SAHPBVolterrainprototype@@PAPAUolterraindatabase@@H@Z)
materset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl databasecreator<class material>::InstallDataBase(class material *,int)" (?InstallDataBase@?$databasecreator@Vmaterial@@@@SAXPAVmaterial@@H@Z)
materset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl databasecreator<class material>::FindDataBase(struct materialdatabase const * &,class materialprototype const *,int)" (?FindDataBase@?$databasecreator@Vmaterial@@@
@SAXAAPBUmaterialdatabase@@PBVmaterialprototype@@H@Z)
Main/Release/Main.exe : fatal error LNK1120: 11 unresolved externals
Error executing link.exe.

I'm pretty sure I've included all needed libraries and other important files, but I just can't figure out what's wrong. I've tried almost everything. Help?
Back to top
View user's profile Send private message
Atomic
archangel


Joined: 12 Jan 2005
Posts: 1442
Location: In the fire

PostPosted: Wed Apr 06, 2005 2:11 am    Post subject: Reply with quote

You're right, .NET doesn't like it. I'm having issues too; in a certain file (not sure which one) a variable is redeclared. Also it has issues with overloading all kinds of math functions, mostly fabs() and sqrt().
The redeclared varible is blatant: something like
Code:

for(int c; c < /*something*/; c++)
{
/*some code*/
int x, c;
/*more code*/
}

_________________
"Also, I'm the only person I know capable of a pelvic pary and riposte." -- Squashmonster

I moderate in red.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Wed Apr 06, 2005 2:16 am    Post subject: Reply with quote

I know. I switched to VS 6 and it didn't give me that error though, so I'm not sure what's going on. Something is... strange. Razz
Back to top
View user's profile Send private message
holybanana
Party Chairman


Joined: 04 Jan 2005
Posts: 155
Location: Above Valpurus

PostPosted: Wed Apr 06, 2005 8:38 am    Post subject: Reply with quote

This is most puzzling. VS 5 and gcc compile IVAN fine, and these errors seem odd, as these template functions are explicitly instantiated, for instance the errors about InstallDataBase should be avoided by these lines at the end of database.cpp:

Code:
#define INST_INSTALL_DATABASE(type)
template void databasecreator<type>::InstallDataBase(type*, int)

INST_INSTALL_DATABASE(material);
INST_INSTALL_DATABASE(character);
INST_INSTALL_DATABASE(item);
INST_INSTALL_DATABASE(glterrain);
INST_INSTALL_DATABASE(olterrain);


Without these lines I get the same errors.

Is dataset.cpp surely compiled? Well, most likely if not, much more errors would be caused. Are we doing the explicit instantiation somehow wrong? :(

You could try trial and error, removing or altering these lines somehow, or moving them to database.h. This may cause only yet more errors, however. It is problematic I don't have access to VS 5.

It is truly annoying the C++ standard about templates is not perfectly supported in any major compiler, there are always bugs, for instance the export keyword is never supported. Sad
Back to top
View user's profile Send private message Send e-mail
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Wed Apr 06, 2005 3:53 pm    Post subject: Reply with quote

Well, it seems that the newer the Microsoft compiler is, the more problems it causes, so I'll try just using GCC to compile it and hope it works. Microsoft has never been too good for making problem-free code. Razz And yes, dataset.cpp is compiled, and I've tried modifying all sorts of possible problem-causing code, but nothing helped. Hopefully GCC fixes things.
Back to top
View user's profile Send private message
holybanana
Party Chairman


Joined: 04 Jan 2005
Posts: 155
Location: Above Valpurus

PostPosted: Wed Apr 06, 2005 6:30 pm    Post subject: Reply with quote

I believe latest VC versions have no prob in compiling normal function and class templates which are fully defined in headers, but member function templates have never worked, and this problem shows they don't fully support templates declared in a header but defined and instantiated only in a compilation unit.

The latest MinGW should be a good GCC choice for everyone using Windows whatever. You can still use VS for project handling and editing, if you like it...

If I ever get access to VC6, I'll do my best to fix these problems, but until then stick to GCC.
Back to top
View user's profile Send private message Send e-mail
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Thu Apr 07, 2005 7:58 pm    Post subject: Reply with quote

I downloaded MinGW and tried it out, and am still running into this problem as it's compiling the .exe:

../lib/gcc/mingw32/3.4.2/../../..SDLmain.lib(./Release/SDL_win32_main.obj)(.tex
t[_main]+0x0):C:public_cvsSDL-: multiple definition of `main'
../lib/gcc/mingw32/3.4.2/../../../libmingw32.a(main.o)(.text+0x0): first defined
here
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS
VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
../lib/gcc/mingw32/3.4.2/../../..SDLmain.lib(./Release/SDL_win32_main.obj)(.tex
t[_main]+0x55):C:public_cvsSDL-: undefined reference to `_alloca_probe'
../lib/gcc/mingw32/3.4.2/../../..SDLmain.lib(./Release/SDL_win32_main.obj)(.tex
t[_WinMain@16]+0x162):C:public_cvsSDL-: undefined reference to `_alloca_probe'

../lib/gcc/mingw32/3.4.2/../../..SDLmain.lib(./Release/SDL_win32_main.obj)(.tex
t[_WinMain@16]+0x1a5):C:public_cvsSDL-: undefined reference to `_alloca_probe'

collect2: ld returned 1 exit status
mingw32-make: *** [D:ProgrammingIVANivan-0.50-Unmodivan-0.50IVAN.exe] Error
1


Looks like something is wrong with my SDL install. I'll try to fix it myself, but if anyone else can give me pointers in the right direction, I'd appreciate it. Not sure why I can't figure these problems out on my own, I'm usually good at this kind of thing. Confused
Back to top
View user's profile Send private message
Atomic
archangel


Joined: 12 Jan 2005
Posts: 1442
Location: In the fire

PostPosted: Thu Apr 07, 2005 8:57 pm    Post subject: Reply with quote

My current problems with MVCN is with math.h functions. I tired of the redeclaring of int c; just changed that to a 'b' and it ignored it. However it's also going nuts on math functions: every call to fabs() or sqrt() are called "ambigous calls to overloaded operators". I don't konw a whole lot about error messages because I usually don't get them, so I don't know what that means. Everything I can see though points at everything being right in the calls...

An example:

Code:
void wsquare::CalculateLuminance()
{
  double T = log(1. + [b]fabs(GetWorldMap()->GetAltitude(Pos)) / 500.)[/b];
  int Element = Min((128 - int(37.5 * T)), 255);
  Luminance = MakeRGB24(Element, Element, Element);
}


Error I get:
Code:
c:Documents and SettingsSupportMy DocumentsVisual Studio Projectsivan-0.50MainSourcewsquare.cpp(171): error C2668: 'fabs' : ambiguous call to overloaded function


I'd like to get this to compile for me so I can code at school, and test my code...[/b]
_________________
"Also, I'm the only person I know capable of a pelvic pary and riposte." -- Squashmonster

I moderate in red.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
holybanana
Party Chairman


Joined: 04 Jan 2005
Posts: 155
Location: Above Valpurus

PostPosted: Thu Apr 07, 2005 9:40 pm    Post subject: Reply with quote

If the parameter is an integer like in the code you pasted, replace fabs by abs. If this doesn't work, replace fabs(something) with fabs(double(something)) and so on for other functions. Let's hope it compiles. Confused
Back to top
View user's profile Send private message Send e-mail
Atomic
archangel


Joined: 12 Jan 2005
Posts: 1442
Location: In the fire

PostPosted: Thu Apr 07, 2005 10:01 pm    Post subject: Reply with quote

I changed everything to fabs(double(etc)) in the entire code, and it fixed a lot of warnings and errors. Hoewver I've got one left:
Code:
Main fatal error LNK1181: cannot open input file 'SDL.lib'

_________________
"Also, I'm the only person I know capable of a pelvic pary and riposte." -- Squashmonster

I moderate in red.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Thu Apr 07, 2005 10:04 pm    Post subject: Reply with quote

Atomic wrote:
I changed everything to fabs(double(etc)) in the entire code, and it fixed a lot of warnings and errors. Hoewver I've got one left:
Code:
Main fatal error LNK1181: cannot open input file 'SDL.lib'


You need to install the SDL library.

http://libsdl.org

And once you fix that one, I'm pretty sure you'll end up with a bunch more warnings/errors. Fun stuff. Razz
Back to top
View user's profile Send private message
Atomic
archangel


Joined: 12 Jan 2005
Posts: 1442
Location: In the fire

PostPosted: Thu Apr 07, 2005 10:20 pm    Post subject: Reply with quote

Downloading SDL was the first thing I did.... Hmm. I geuss i could try again.

I downloaded the source files, not the .dll, becaues I saw that SDL.h was included in some of the IVAN source. Do I need to get the .dll or something?
_________________
"Also, I'm the only person I know capable of a pelvic pary and riposte." -- Squashmonster

I moderate in red.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Thu Apr 07, 2005 10:23 pm    Post subject: Reply with quote

Atomic wrote:
Downloading SDL was the first thing I did.... Hmm. I geuss i could try again.

I downloaded the source files, not the .dll, becaues I saw that SDL.h was included in some of the IVAN source. Do I need to get the .dll or something?


You need the source files. Did you remember to add the needed directories to the VS include/lib directories?
Back to top
View user's profile Send private message
Atomic
archangel


Joined: 12 Jan 2005
Posts: 1442
Location: In the fire

PostPosted: Thu Apr 07, 2005 10:31 pm    Post subject: Reply with quote

Of course. It finds SDL.h and all the other stuff; only issue is that SDL.lib seems to be missing. I can't even find it when I hunt for myself. What version of SDL do I need? I d/led 1.2.8.
_________________
"Also, I'm the only person I know capable of a pelvic pary and riposte." -- Squashmonster

I moderate in red.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TheFallenOne222
gibberling


Joined: 03 Apr 2005
Posts: 166

PostPosted: Thu Apr 07, 2005 10:34 pm    Post subject: Reply with quote

Not completely sure. Either way, it doesn't look like it's going to work without a bunch more major code changes. I tried setting it up in .NET, and fixed up everything you did, and now I'm back to linking errors.


Linking...
charset.obj : error LNK2019: unresolved external symbol "public: static int __cdecl globalwindowhandler::GetKey(int)" (?GetKey@globalwindowhandler@@SAHH@Z) referenced in function "protected: void __thiscall character::GetPlayerCommand(void)" (?GetPlayerCommand@character@@IAEXXZ)
game.obj : error LNK2001: unresolved external symbol "public: static int __cdecl globalwindowhandler::GetKey(int)" (?GetKey@globalwindowhandler@@SAHH@Z)
FeLib.lib(felist.obj) : error LNK2001: unresolved external symbol "public: static int __cdecl globalwindowhandler::GetKey(int)" (?GetKey@globalwindowhandler@@SAHH@Z)
FeLib.lib(feio.obj) : error LNK2001: unresolved external symbol "public: static int __cdecl globalwindowhandler::GetKey(int)" (?GetKey@globalwindowhandler@@SAHH@Z)
charset.obj : error LNK2019: unresolved external symbol "public: static int __cdecl globalwindowhandler::ReadKey(void)" (?ReadKey@globalwindowhandler@@SAHXZ) referenced in function "public: virtual void __thiscall character::Be(void)" (?Be@character@@UAEXXZ)
FeLib.lib(feio.obj) : error LNK2001: unresolved external symbol "public: static int __cdecl globalwindowhandler::ReadKey(void)" (?ReadKey@globalwindowhandler@@SAHXZ)
FeLib.lib(felist.obj) : error LNK2001: unresolved external symbol "public: static void __cdecl graphics::BlitDBToScreen(void)" (?BlitDBToScreen@graphics@@SAXXZ)
FeLib.lib(feio.obj) : error LNK2001: unresolved external symbol "public: static void __cdecl graphics::BlitDBToScreen(void)" (?BlitDBToScreen@graphics@@SAXXZ)
game.obj : error LNK2019: unresolved external symbol "public: static void __cdecl graphics::BlitDBToScreen(void)" (?BlitDBToScreen@graphics@@SAXXZ) referenced in function "public: static void __cdecl game::BusyAnimation(class bitmap *)" (?BusyAnimation@game@@SAXPAVbitmap@@@Z)
igraph.obj : error LNK2001: unresolved external symbol "public: static void __cdecl graphics::BlitDBToScreen(void)" (?BlitDBToScreen@graphics@@SAXXZ)
levelset.obj : error LNK2001: unresolved external symbol "public: static void __cdecl graphics::BlitDBToScreen(void)" (?BlitDBToScreen@graphics@@SAXXZ)
FeLib.lib(bitmap.obj) : error LNK2001: unresolved external symbol "public: static void __cdecl graphics::BlitDBToScreen(void)" (?BlitDBToScreen@graphics@@SAXXZ)
iconf.obj : error LNK2019: unresolved external symbol "public: static void __cdecl graphics::SwitchMode(void)" (?SwitchMode@graphics@@SAXXZ) referenced in function "private: static void __cdecl ivanconfig::FullScreenModeChanger(struct truthoption *,int)" (?FullScreenModeChanger@ivanconfig@@CAXPAUtruthoption@@H@Z)
igraph.obj : error LNK2019: unresolved external symbol "public: static void __cdecl graphics::SetMode(char const *,char const *,struct v2,int)" (?SetMode@graphics@@SAXPBD0Uv2@@H@Z) referenced in function "public: static void __cdecl igraph::Init(void)" (?Init@igraph@@SAXXZ)
main.obj : error LNK2019: unresolved external symbol "private: static int (__cdecl* globalwindowhandler::QuitMessageHandler)(void)" (?QuitMessageHandler@globalwindowhandler@@0P6AHXZA) referenced in function "public: static void __cdecl globalwindowhandler::SetQuitMessageHandler(int (__cdecl*)(void))" (?SetQuitMessageHandler@globalwindowhandler@@SAXP6AHXZ@Z)
SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main
.Main/Release/Main.exe : fatal error LNK1120: 7 unresolved externals




If I could get it compiled in at least ONE program (Even MinGW doesn't seem to be working for me...), I'd be set.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ivanforum Forum Index -> Programming All times are GMT
Goto page 1, 2  Next

Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group