|
Hi,
Well, there are a few considerations here. 'C', 'CPP' are examples of languages which produce code running close to the OS, and the Hardware. One works there on the coal face, dealing directly with actual memory locations, and de Operating System. the vagarities of the hardware components, etc. This can lead on occasion to hard to detect bugs, and crashes. A Strash is a famous example. Another consideration is that the Supplier of the OS can literally pull the carpet from underneath your feet, by deprecating your favourite OS. Another disadvantage is that you must maintain different versions of Source Code if you want toi write for more than One Platform.
On the other hand, just because you deal directly with the OS and Hardware, you can do all sorts of tricks that cannot be done in'Synthetic' languages, such as say C# or Java. These languages run on a 'Virtual Machine' in a 'Virtual Environment' When you find yourself in such an environment, you may forget about playing even the most innocent trick. That virtual machine knows nothing about memory, but talks in variables. The advantage here is, that this a far more friendly environment to write in, it tries not to allow you to write wrong code. Also, your code will probably run from now till kingdom come on every computer and OS.
Now, it should also be remembered, that as a society, we cannot ever dispense with languages such as C and CPP. Languages such as C# Java, and many others are actually written using 'C' and 'CPP'
I personally think that you could do worse than learning 'C' and 'CPP', in particular if in the latter you incorporate 'MFC'
Note: C# Java, vs 'C' and 'CPP' are very similar in syntax. The devil is in the syntactical detail!!!
Regards,
Bram van Kampen
|
|
|
|
|
Hi there.., i am learning opengl from the NeHe tutorials(NO GLUT).
i am getting the error
undefined reference to 'auxDIBImageLoadA' while compiling.
i am using codeblocks.
the codeblock is:
AUX_RGBImageRec *LoadBMP(char *Filename)
{
FILE *File=NULL;
if(!Filename)
{
return NULL;
}
File = fopen(Filename,"r");
if(File)
{
fclose(File);
return auxDIBImageLoad(Filename);
}
return NULL;
}
I have added libglaux.a already in the linker settings.
HELP!!!!
modified 7-Apr-16 11:10am.
|
|
|
|
|
Perhaps you are missing a header file.
Ratul Thakur wrote: i am getting the error undefined reference to 'auxDIBImageLoadA' while compiling. What is the EXACT error message you are receiving?
Ratul Thakur wrote:
I have added libglaux.a already in the linker settings. Which is irrelevant because you are dealing with a compiler error. The linker does not kick in until the compiler succeeds.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 7-Apr-16 11:58am.
|
|
|
|
|
no m not missing the header (-_-)
m not that noob.
i know the
#include<gl/glaux.h>
header file.
modified 7-Apr-16 11:41am.
|
|
|
|
|
It looks like the compiler is generating an ASCII version of the call to auxDIBImageLoad , so it may be that you need a different library to be linked with. Check the GL documentation.
|
|
|
|
|
auxDIBImaheLoad comes from the GLAUX library which is obsolete and no longer supported by Visual studio which is why it can't find it. Even adding include "GLAux.H" wont help as the library file has been removed as well as the DLL.
If you are just playing around the source code and precompiled GLAUX.DLL are available on the internet but anything beyond that do not use it.
All that function does is loading an image file as a texture one second let me fashion you a replacement it will take longer to explain how to do it that to do it. Can you tell me what lesson this is from on the NeHe site and I will post result to them to update it on next message
In vino veritas
modified 8-Apr-16 5:08am.
|
|
|
|
|
Okay I found you are trying to do Lesson6 and the function LoadGLTextures() basically puts a texture into this variable
GLuint texture[1]; // Storage For One Texture
I have given you a new function which directly loads the texture
bool NeHeLoadBitmap(LPTSTR szFileName, GLuint &texid);
The call to it looks like
NeHeLoadBitmap(_T("Data/NeHe.bmp"), texture[0]))
Yes I unicoded the whole thing and set optimal screen resolution again and its in VS2013 project
Code link: http://s000.tinyupload.com/?file_id=94912123294851978142
I have a little job to do this weekend I guess which is to patch each lesson and send them to the site
In vino veritas
modified 8-Apr-16 5:16am.
|
|
|
|
|
Thanks a lot for your effort.., i ll try this one out and tell you if it works
|
|
|
|
|
YEH!!!!!!!! it worked. Thanks once again.
But what is the use of "_T". if i compile without including it, the application still works fine.
|
|
|
|
|
The _T is a macro provided by TCHAR.H for unicode/multilingual support. If you go to the project settings->general tab->Character set you will have that to "not set" setting. That macro allows you to use the other choices being unicode and multi-byte character sets making your code work multilingual like in chineese windows.
For you in ascii mode the macro actually does nothing (which you worked out) but if you select the other modes you will see you will get an error on every static text the _T tells the compiler to make the string in the correct mode and removes the error.
Being a commercial programmer and as Microsoft has made it so easy for doing it we generally try and use the multilingual code calls since Visual Studio 2013. This became almost compulsory when trying to write true 64 bit applications. The default setting of an empty project is actually to set for unicode character set.
Essentially TCHAR becomes a replacement for the standard char and its size varies in the compilation modes. They provide new string functions that match the old string functions in TCHAR.H but have different code for the different modes. Lets give you an example
strlen becomes _tcslen those calls work identical the difference being _tcslen will work in any language mode compilation, while strlen will only work in language "not set" mode like you have. Here is the link to what is going on from MSDN
strlen, wcslen, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l[^]
This code is designed specifically for windows (it uses the Win32 API), it is not general in nature like that could work on linux so there is no reason to write generically but we should try and cover the different modes of windows compilation, especially as it is easy.
So for me the changes are just habit.
There is a funny part of this that so many of us are writing in that style that the linux community is having issues trying to port our code. So if writing general code I would probably try to avoid this style of programming.
In vino veritas
modified 8-Apr-16 23:28pm.
|
|
|
|
|
Hi
I am using Mailslots for Interprocess communication. Process A does a WriteFile with NULL for the overlapped parameter.
Process B has a overlapped parameter on the ReadFile.
My question is Can process A do WaitForSingleObject on the hEvent of process B overlapped to know when the read has completed
Thsnks
|
|
|
|
|
|
I did in a ReadFile for a mail slot when the i/o is completed shouldn't hOverLap.hEvent be signaled ?
|
|
|
|
|
|
|
I read the article
Which basically Said if I CreateFile on the Client Side with FILE_FLAG_OVERALAPPED
File then when doing an I/O which I would assume would include ReadFile on the Server side
An Overlapped structure would be used (A member of which is m_hEvent
I did a OpenEvent on the Client side as The CreateProcess let me inherit objects
tried WaitForSingleObject (m_hEvent of the overlapped of the ReadFile)
the First wait worked the second didn't as I did three writes
|
|
|
|
|
ForNow wrote: First wait worked the second didn't as I did three writes
"Didn't work" is hardly a technical description of the problem. Are you forgetting to reset a manual-reset event?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Don't think so the flag is set to False it should auto-reset
sysblk.mail = CreateEvent(&sa,
FALSE, FALSE, (LPCTSTR)"MyEvent");
|
|
|
|
|
Well maybe the writes are occurring so quickly that the system only has time to signal the event one time.
Whenever the event is signaled, you should check for more messages before looping back to the wait function.
Don't expect the event to be signaled exactly once for each message you write.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You are probably right the WriteFile has a NULL for the overlapped While the ReadFile has a overlapped paramater
|
|
|
|
|
The WriteFile doesn't need or require an overlapped access and I would be intrigued what security attributes you are feeding in via sa. Naming the event is fine but why are you needing to provide specific security attributes are you doing something special?
The worry I gleaned was you hold the event handle in sysblk.mail are you remembering to copy the handle reference into your overlapped structure? It's sort of odd what you are doing there but not wrong so long as you remember to transfer the handle.
The usual read thread code direct from MSDN looks like
char buffer[100];
OVERLAPPED ovlp = {0};
ovlp.hEvent = CreateEvent(NULL, false, false, NULL);
if (ovlp.hEvent == NULL) {
}
DWORD read;
do {
ReadFile(mailslot, buffer, sizeof(buffer), &read, &ovlp);
buffer[read] = 0;
WaitForSingleObject(ovlp.hEvent, INFINITE);
process_message(buffer);
} while (strcmp(buffer, "exit"));
The write thread is create function is non overlapped
HANDLE mailslot = CreateFile("\\\\.\\mailslot\\myslot",
GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
0,
NULL);
They are the by the book MSDN examples and your code should be some extension of that process inside your sysblk code.
Also remember this sort of thing is for relatively low speed, small packet exchanges if you want to go beyond that you need to change to memory mapped files.
In vino veritas
modified 5-Apr-16 23:21pm.
|
|
|
|
|
Hello Sir,
Can anybody help me how to customize the ribbon bar means adding ribbon category at run time similar to the QAT custmization
Any sample code or reference is much appreciated
Thanks,
Ashish
asdsa
|
|
|
|
|
|
Hi,
Does anyone have a program written in C++ that would allow input of C type syntax e.g. if(x>0 && x<9), parse this statement and produce a node tree.
I have being doing some research and have code written to read in the statement and split each item, but from here I am lost. I think I am supposed to use a LALR analyser and produce a syntax tree.
Any help appreciated from a stressed out woman!
|
|
|
|
|
Sorry but this site does not provide code to order. You need to be more specific about the help you need.
|
|
|
|