[RESOLVED] unresolved externals??
ok, I've gotten this problem before, but usually when I erase everything, and completely re-write it it works. but I don't feel like doing that again, I want to know why it's not working (and I have another program I made exactly like this one that works perfectly.. and I've been trying to copy it, but I can't find any more differences (other then variable names and such)
I've googled this problem before and came up empty handed, it looks like the problem occurs when a function is declared but not used.. but to me it looks like it is used... here is the code (simplified for easier diagnosis)
Main.cpp:
Code:
#include <Windows.h>
#include <iostream>
#include "Headr.h"
using namespace std;
int main()
{
int e = 12;
int r = 12;
int ret;
ret=sendint(e,r);
cout << ret ;
cin.get();
return 0;
}
second.cpp:
Code:
#include <Windows.h>
#include <iostream>
#include "Headr.h"
using namespace std;
int sendint(int x,int y)
{
cout << x << y;
return 0;
}
Headr.h
Code:
int sendint(int x,int y);
any Idea's? thanks, I owe you guys a lot already :)
Re: unresolved externals??
Which external is unresolved? Post the exact message. Why are you including Windows.h?
Re: unresolved externals??
On my system using MSVS the code you have posted compiles and links cleanly with no errors and produces the correct output when run. If this code is giving you a linker(?) error then it must be how the solution/project has been setup. Has second.cpp been added to the project properly? When you build the solution does it say that it's compiling main.cpp and second.cpp? In the solution explorer, under Source Files you should see both main.cpp and second.cpp listed.
Re: unresolved externals??
wow.. >.< apparently I had made the second "cpp" file, as a header file instead, fixed that, runs perfect now... jeeze, I hate when you waste and hour or two when stuff like that happens >.< thank you guys, now I feel silly :p
thanks again!
Re: unresolved externals??
Quote:
Originally Posted by
peteandperry
I hate when you waste and hour or two when stuff like that happens >.< thank you guys, now I feel silly :p
thanks again!
These things happen to the best of us!:D Don't tell anyone - but I once spent several hours trying to find a problem in a program - it turned out I was debugging the wrong set of code.:rolleyes: