|
Hi ppl,
I just ran my first VC++ program yesterday(yeah, friday night). It was a simple code to add/subtract 2 numbers when the add/sub button is pressed.
The answer is displayed in a static text box. The user can enter their numbers in the text boxes.
The program worked great, I went to bed happy.
So today I open the code and try to run it, I got the following errors-
___________________________________________________
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/bdDlg.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
_____________________________________________________
Now, even class wizard doens't open.
I am absolutely sure I haven't made any changes. This problem happens when I close VC++ and open it again.
How do I make it stop.
Thanks in advance.
-hithesh
|
|
|
|
|
|
The link problem is because you have some specified using a single threaded library. MFC often requires multi-threaded libraries even if you're using a single thread. You can change this in the project settings.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Erik,
I changed it to multi-threaded shared. This got rid of the first 2 errors.
The last 2 are still there -
ibcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/bdDlg.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Any help?
|
|
|
|
|
For some reason your project thinks you're using a console application and is looking for main function rather than a WinMain. This doesn't make any sense that it was working and now it doesn't. It is like you created a console application instead of an MFC one using the app wizard.
I'd suggest creating a new MFC application, then copying your changes into the new project.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Why don't you try to build new application from the start(it's only few lines..:->)?
when you do so,don't change the default configuration.
Regards,
Eli
|
|
|
|
|
Erik , eli,
Thanks for the reply.
Today morning, I did the whole code again. I selected mfcappwizard.exe as project type. The code ran successfully. So I cancelled, vc++ and restarted it again.
I tried to execute the code, but got the same 2 errors again -
_________________________________________________
error LNK2001: unresolved external symbol _main
Debug/bdDlg.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
________________________________________________
Help me guys!
thanx
-hithesh
-hithesh
|
|
|
|
|
can you send me your project,so i will test it under my visual c++?
my email is:
eli.vaknin@gmail.com.
regards,
Eli
|
|
|
|
|
|
Mike,
Thanks for the reply. I googled and got rid of the beginthreadex and endthreadex errors.
I can't get rid of the unresolved externals error.
As mentioned in the link u gave me, I tried to remove the _ATL_MIN_CRT symbol from preprocessor category. But there is no _ATL_MIN_CRT there.
Just " WIN32,_DEBUG,_CONSOLE,_MBCS ". Any help?
-hithesh
|
|
|
|
|
I solved the problem. It seems that VC++ was not saving the files when I closed it.
I just did "save all" before closing VC++ and this has solved the problem
So remember to save ppl. I wasted 2 days trying to figure out what was wrong. It was total frustration!
-hithesh
|
|
|
|
|
i was trying
system(del(filename));
but its giving error any ideas???
thanks
|
|
|
|
|
That's really going the long away around to delete a file. How about the DeleteFile function?
|
|
|
|
|
Try:
#include <stdio.h><br />
remove(const char *filename);
|
|
|
|
|
Del is not a program. It's a shell builtin, just like dir is. Thus, system doesn't know what Del is. There is no del.exe.
Use DeleteFile if you're using Win32 code, or remove if using standard C code.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Erik Funkenbusch wrote:
Del is not a program. It's a shell builtin, just like dir is. Thus, system doesn't know what Del is. There is no del.exe.
del.exe doesn't exist, but system() doesn't launch programs. it executes shell's commands, just as del , dir , cls ...
if you try system("cls"); , your screen (in console mode, of course) will be cleared...
the problem in monageasmear's code is that he doesn't enclose the system() 's parameter into "" ...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i think if you had written
system("del filename"); if would have worked.
first, you must know the del shell's command syntax ;
secondly, if you had a look at the MSDN, you would see that system() gets a LPCTSTR , it means a const TCHAR* , that's why i use a string parameter...
and to finish, system() is not recommended, as Graham Bradshaw , [DFS] Zero and Erik Funkenbusch said...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
I'm using a ginastub on my workstation and I need to switch between two differents GINAs asking to press a keyboard to select one or another.
Is it possible to use the _kbhit function into the MyInitialize ginastub func?
|
|
|
|
|
sorry im new to c++i no this is a simple problem but help would be greatly appreciated
convert an int to a string?
cheers
|
|
|
|
|
_itoa
CString::Format
sprintf
strstream class
etc
Many different ways
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
sorry can you please post the code example
int fig = 2;
string string1;
thanks
|
|
|
|
|
try using string streams from sstream.h
int fig = 2;<br />
std::string string1;<br />
<br />
std::ostringstream oss;<br />
oss << fig;<br />
string1 = oss.str();
|
|
|
|
|
int fig = 2;
string string1;
strstream stream;
stream << fig << ends;
string1 = stream.str();
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Don't use streamstring, it is VERY SLOW.
sprintf works must faster.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
CString str;
int i=5;
str.Format("The integer Number is : %d",i);
|
|
|
|