|
Hello,
I can't get rid of error LNK2001: unresolved external symbol _errno. I asked for help concerning this last week and got some answears, thanks a lot for them , but unfortunately they didn't help.
So, at the moment the situation is like this. The starting point of my program is main() and it uses a library, that is written in C and supports MFC. The file where main is is a .c -file. Besides that file I have a few files for GUI, the library and a couple of .c -files written in C.
I should use makefile, but I'm trying to get this working first with project/settings -options and then I'll export a makefile. I have set "Use MFC in a static library" from Project/Settings/General, "Multithreaded" from Project/Settings/C/C++/CodeGeneration/Use run-time library, "Automatic use of precompiled headers through header stdafx.h" from .../C/C++/Precompiled headers. I have also forced the program to be compiled with an option /TP. I also had to deny usage of two default libraries with linking options /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib", because they conflicted with the library licmtd.lib.
The result is, that I get "LNK2001: unresolved external symbol _errno". The place where I get it from is inside the library written in C, that I'm using. If I used libc.lib and denied the usage of two others I would get 66 unresolved externals instead of errno and if I used only libcmt.lib, I would get 45 unresolved externals including errno.
I have the source code of that library, but I can't modify it. In that file, where I get this error from header errno.h is included, but it is inside #ifndef _INCLUDE__STDC__. Could this be the reason why errno is unresolved? The calling convention that I'm using is __cdecl, from .../C/C++/CodeGeneration/Calling convention. I tried using stdcall, but I only got some more linking errors.
I've also tried using extern "C" with all the headers written in C, and it didn't help. What I concluded, is that libc.lib includes the definition of errno, but libcmt.lib and libcmtd.lib don't.
What should I do? Would making a dll help.
-Janetta
|
|
|
|
|
As far as I can see the problem is, that the multithreaded versions of the CRT do not define errno, because it would not fit into a multithreaded environment, but you import a .lib that was linked against the single threaded CRT and therefore expects errno to be defined somewhere.
(The MT version do not define it because using a single errno variable for multiple concurrent running threads is not a really good idea).
You have to link all parts of your project (all .lib files you create on your own and the .exe) again exactly the same version of the CRT, so you got no linking conflicts. Using /nodefaultlib is only a "hack solution" and leads to problems like yours.
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Thanks a lot! It works now!
It wasn't a big thing to do and now it seems obvious, but earlier it didn't.
-Janetta
|
|
|
|
|
I am facing problem of finding from where exceptions are coming. For this I started to look mapfiles generated by /MAP option in the link tab of Visual Studio editor of MSDev. But could not understand fully. I am using Dlls also with Exe file and when exception comes from Dll then its not clear how to locate the exception in mapfile using the address of exception we have gotten from execution and addresses given in mapfile
Actually my project contains one exe and 3 dlls. Now map files are there for exe and dlls as well. When exe gets exceuted there are times when exception comes from dlls. While looking map files for dlls, there is some calulation required to get the at least function name from where exception came. This caculation is needed because preferred base address given in the dll map file is different than where dll was actually loaded while executing the program. Crash address is in respect to where dll was loaded while addresses in the map file are with respect to preferred base address.
Arvind Kumar Maurya
|
|
|
|
|
The full answer to this question you can find in John Robbins's book "Debugging Applications" (Microsoft Press 2000). It contains also very nice program CrashFinder that helps to do this.
|
|
|
|
|
I found a program named "TrimmerVB"(it's a VB sample of AVI/MOV editng in DirectX 8.1 SDK).
I want to use its functions in my VC++ frame. But I don't know how to do that.
Thanks for giving any further advice.
Win2k, VC++ 6.0 SP5
|
|
|
|
|
I want two Rich edit control in my application with coloring , highlighting and selection facilities . I want to change these views into the splitter windows and then change their layout at runtime . Means fron horizontal splitting to vertical splitting . I also want a popup sort of window available for a text associated with selected word
Can anyone suggest a good class available for it.
Samir Sood
|
|
|
|
|
Hello everybody,
I try to figure something elementary:
- in my HTML page, I should have an IMG tag, with
src="MyISAPI.dll?parameter1=value1"
- the called ISAPI dll should read a bitmap file from
disk, and Write to client.
- I don't use MFC in my application.
How should I do this elementary task? What I am missing?
I tryed to send "Content-Type" header, before sending bitmap
stream, but... something I mess.
Really I need and advice, or some lines of working code.
Many thanks in advance,
Regards,
MN
|
|
|
|
|
I created a project in VS6/MFC and upgraded to VS.NET. However, I don't know how to add a handler for a toolbar button. The MSDN said in resource view, properties, ... but i couldn't find.
In my application, I put the toolbar in a MDI childframe, and handle the commands in the view.
|
|
|
|
|
If you use the default toolbar:
In your resource view you have a resource called "Toolbar". If you have a look at that, you will see a number of predefined buttons. You can add your own as well. When you have added a button, select it and press Alt+ Enter to get its properties. There you have to fill in an ID for the button.
Use this ID to add a command handler to MainFrame.cpp. Note that the ID is also seen in the String Table resource.
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_COMMAND(ID_YOUR_BUTTON, OnYourButton)
END_MESSAGE_MAP()
If you have added an extra toolbar, e.g. a CDialogBar, then it is a good idea to write a class encapsulating it.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
While iam saving the contents of the window as a bitmap file,only the portion which is visible is getting saved.iam using win32 api programming.how to make the full window save.
|
|
|
|
|
You need to get the window to draw itself in order to save it. If it's not being drawn to the screen, where do you expect to pull the bitmap from ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Any one has idea for how to do this via code and the apis to use.
thanks in advance.
|
|
|
|
|
I have looked in C books but I cannot find threads available in C. So I guess I will have to use someone’s library to get thread functionality in my C programs. Can some please tell me from where can I download such a library? My basic problem is that I have made a real time scheduler in C with custom functions working as threads, the problem is that in order to have complete functionality of real time one must be able to stop the function at any time and latter resume them. That functionality is only possible with threads but simple C does not has this functionality built in. I have to compile it on windows. Please Help.
If such a solution is not possible then I will have to make a sort of a parser that will parse the functions and perform every single addition, multiplication, and division through a set of variables that I will consider registers. By storing those registers and resuming their value I might be able to achieve thread functionality. But there is another problem with that; firstly I store the functions as function pointers in an array, and latter after scheduling I pick them up from there. So is there a way that I can convert the contents of the function by that function pointer to a string so that latter I can parse the contents of the function or do I have to follow another approach. Please help with this problem as my deadline is nearing.
OnlyHuman23
|
|
|
|
|
|
I need to create an image list for a drag and drop thing I'm doing. I thought the problem was that I wasn't getting the wm_mousemove message. I was but it also wasn't create the image list. The code:
CImageList* m_pDragImage;
m_pDragImage = CreateDragImage( m_hItemDrag ); I know m_hItemDrag is good because I can do GetItemText(m_hItemDrag) and it gives me the proper text. CreateDragImage just returns NULL so something isn't working. Any ideas?
-Raffi
|
|
|
|
|
Right. What sort of an object are you working with? A CTreeCtrl ? A CListCtrl ? And do you have an image list associated with the control?
--------
PMGRE --Shog9 --
|
|
|
|
|
Does anyone know if it's possible to pass arguments to the constructor of array elements?
For example: I have a class Cfoo
class Cfoo
{
public:
Cfoo( int arg1 = 0 );
private:
int m_arg1;
}
I want to create an array of 200 Cfoo's, and initialise them with Cfoo(-1). I've tried
aFoo = new Cfoo(-1)[200];
aFoo = new Cfoo[200](-1);
I've run out of ideas
Is it impossible to call ctors on members of dynamically declared arrays?
TIA,
Pete
|
|
|
|
|
If you were to use vector, then it would be easy. But what you're trying to do is not possible AFAIK.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
just to expand on what the previous poster said:
here's an example (from google):
class Foo() { ... Foo(int, long, char, char*) { } ... };
vector<Foo> myArray(10, Foo(1, 2, 3, "hello"));
unless you have a *very* specific reason for using "new []", std::vector is usually a better way to go.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
well it should work
memset (aFoo, -1, 200);
i guess this should work...
bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Thanks for the input guys.
It seems that most of my questions on CP these days lead to a new appreciation for the STL
Thanks again,
Pete
|
|
|
|
|
...does the following code hang and or lock up my app. I'm using the MSComm32 ocx for serial communications, and m_Comm is a member variable to my Control Class. If I trace out the "input" I'll see the correct data flowing through, and If I monitor the serial port it shows the connect but, my app just hangs there.
BOOL bConnected = FALSE;
CString sInput;
while(!bConnected)
{
if (m_Comm.GetInBufferCount() > 0)
{
sInput = m_Comm.GetInput();
sInput.MakeLower();
if (sInput.Find("connect") != -1)
bConnected = TRUE;
}
}
As far as I can tell, this should work. But it doesnt.
Thanks,
Frank
|
|
|
|
|
You've traced this through and sInput does indeed contain the word 'connect' ???
Why are you using a BOOL instead of a bool ?
Personally I'd also include a timeout in code like the above. What if m_Comm.GetInBufferCount() remains 0, or sInput.Find("connect") continues to be -1 ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
Why are you using a BOOL instead of a bool ?
This may sound stupid...but, um...what the difference?
Christian Graus wrote:
Personally I'd also include a timeout in code like the above. What if m_Comm.GetInBufferCount() remains 0, or sInput.Find("connect") continues to be -1 ?
Its in my TODO list.
Seriously, I've got 2 of these while loops. The only way I've even remotely been able to get them to exit properly is to include a 'break' after the if returns true.
Thanks Christian,
Frank
PS, whats the weather going to be like tomorrow?
|
|
|
|