|
i have my C++ code that i developed in Visual Studio 2008
the solution contains 4 projects
i want that code to be ported to LINUX. i know the linux complier is GCC and i have no clue how to do it. i think it is done using a makefile but still if u ppl can help me.
|
|
|
|
|
VS2008 does not have a "makefile" export; So, you'd better sit down and learn how to manually generate makefiles which is one of the devil created file format (IMO). You might be interested in using one of the many IDE available on linux (kdevelop, ... ) that should ease your pain by "wrapping" the makefile in a nice environment.
One the other hand, depending on how much your application is tied to Visual Studio and/or windows (API and framework) the makefile might be the least of your problem.
M.
Watched code never compiles.
|
|
|
|
|
There are many tutorials and 'makefiles how to' on the web, see, for instance [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
See if this helps.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
hi,
i am trying to make a customized Clist control. i have written my Class derived from CListCtrl. The problem is in this Vertical scroll bar are not coming when i dynamically create this list control. if i create it in resource and use DDX_Control and take it as my class variable it works fine(scroll bar comes) but if i create control dynamically scroll bars dont come. This is the creation code
m_pList = new CCustomList(12);
m_pList->Create(LVS_REPORT | LVS_SINGLESEL | LVS_EDITLABELS | WS_CHILD | WS_TABSTOP ,
CRect(0,0,620,100),this,IDC_LIST3);
DWORD dwStyle = m_pList->GetExtendedStyle();
dwStyle |= (LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
m_pList->SetExtendedStyle(dwStyle);
please help if any one has any idea. i searched on net there are many ways to remove them but no solution how to show them.
Thanks
|
|
|
|
|
hey guys
i got it.. i dint insert enough items thats why it was not coming...
Thanks
|
|
|
|
|
I want to emulate pressing a pushbutton.
I call SendDlgItemMessage(hDlg,IDBUTTON,BM_SETSTATE,TRUE,0L);
and then I have tried calling RedrawWindow(GetDlgItem(hDlg,IDBUTTON),NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_INTERNALPAINT);
with various flag combinations, but the button will not redraw.
If I call MessageBox after the RedrawWindow, the button redraws, but I don't want to do that!
What am I missing?
|
|
|
|
|
Try the following scenario :
...
{
...
SendMessage(hBtn, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(10, 10));
RedrawWindow(hBtn,...);
Sleep(100);
SendMessage(hBtn, WM_LBUTTONUP, MK_LBUTTON, MAKELONG(10, 10));
...
}
virtual void BeHappy() = 0;
|
|
|
|
|
I am getting the following error:
error C2143: syntax error : missing ')' before '&'
on building the below code:
typedef unsigned int uint4;
void Find(uint4& a, uint4 b, uint4 c);
void Find(uint4& a, uint4 b, uint4 c)
{
. . . .
}
I do not see any error in code.
Any idea as to why this error is coming up?
modified on Tuesday, April 6, 2010 4:40 AM
|
|
|
|
|
void Find(uint4& a, uint4 b, uint4 c,);
^
What's the purpose of that comma?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
sorry thats a typing mistake here
|
|
|
|
|
Your code compiles fine with my C++ compiler (are you using a C compiler?).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yes I guess
how to find that in visual studio
I have written the code in a .cpp file
|
|
|
|
|
.cpp source files are compiled (by default) with the C++ compiler.
However, the default behaviour may be overriden by the /TC compiler option, see [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks Pallini for the inputs.
I think I have got the bug.
Actually in the VC project the file where I had been calling the fn. is .cpp while I have define it in a .c file.
I guess this may be the problem.
|
|
|
|
|
rupeshkp728 wrote: Actually in the VC project the file where I had been calling the fn. is .cpp while I have define it in a .c file.
I guess this may be the problem.
Please note you cannot use references (e.g. 'uint4 & ' as your function's parameter) in C language.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yes I have changed the file name to .cpp
|
|
|
|
|
I'm not sure how using multiple .cpp files to create one .exe works but I'm attempted to using multiples to create just one .exe file. I'm currently using Microsoft Visual Studio 2008 and I've created a project built the project, and ran the file. I've either done something incorrect, or my idea of how this would work is wrong, in which case, my bad.
#include "DarkGDK.h"
void drawBlueBox();
void drawRedBox();
int x=319;
void DarkGDK()
{
dbSetWindowOff();
dbMaximiseWindow();
dbSetDisplayMode(1280, 1024, 32);
while(x=319){
dbCLS();
drawBlueBox();
drawRedBox();
}
dbWaitKey();
}
void drawBlueBox()
{
int red = dbRND(255);
int green = dbRND(225);
int blue = dbRND(225);
DWORD blue1 = dbRGB(red, green, blue);
DWORD black = dbRGB(0, 255, 0);
dbInk(blue1, black);
dbBox(0, 0, 639, 511);
}
void drawRedBox()
{
int red = dbRND(255);
int green = dbRND(225);
int blue = dbRND(225);
DWORD red1 = dbRGB(red, green, blue);
DWORD black = dbRGB(0, 255, 0);
dbInk(red1, black);
dbBox(640, 512, 1280, 1024);
}
#include "DarkGDK.h"
int y=0;
void main()
{
int width = dbScreenWidth();
int height = dbScreenHeight();
int mouseX = dbMouseX();
int mouseY = dbMouseY();
dbPositionMouse(dbScreenWidth()/2, dbScreenHeight()/2);
DWORD white = dbRGB(255, 255, 255);
DWORD black = dbRGB(0, 255, 0);
while(y=0){
dbInk(white, black);
dbText(350, 150, "Screen Width: ");
dbText(460, 150, dbStr(width));
dbText(120, 350, "Screen Height: ");
dbText(240, 350, dbStr(height));
dbText(120, 363, "Mouse Position: ( , )");
dbText(255, 363, dbStr(mouseX));
dbText(297, 363, dbStr(mouseY));
dbWait(50);
}
}
The first .cpp file makes a full screen window that makes two randomly color changing boxes, while the second .cpp files tracks your mouses movement as you move it across the screen and displays it. The code on either .cpp files is running properly when compiled alone and into two separate .exe files. If someone could explain exactly how one .exe file made with multiple .cpp files would run I think that would also be helpful.
|
|
|
|
|
I think you don't really understand how to work with multiple cpp files. In fact, the two files are not "executed at the same time". You still have only one main function which will get called when your program start. If you want to call some functions defined in your second cpp file, you have to call them in your main function.
In fact, having multiple cpp files very similar (in the way of calling the functions I mean) as having only one cpp file. It is used to structure your program a bit more nicely (you don't have one huge file with everything in it).
|
|
|
|
|
That is what I was coming to think after I actually got the entire project to build and run and it still wasn't working the way I had been expecting. So to get the "main" function of the second .cpp file to run i have to call it within the other one using the same method used for calling the two functions that made the two different colored boxes correct?
|
|
|
|
|
gamefreak2291 wrote: So to get the "main" function of the second .cpp file to run i have to call it within the other one using the same method used for calling the two functions that made the two different colored boxes correct?
Yes, but the problem is that you have a while loop in both of your functions, which means that you still won't achieve what you want. You need to have only one loop in which you execute your code.
|
|
|
|
|
Yeah, that how the issue began, I want to have two continuous loops running. One looping at every possible interval(mouse position), the other looping every second or so(changing the colors of the squares). I was wanting to do this without having to create two separate executable files and running then side by side.
|
|
|
|
|
I suggest you take a look at some tutorials about game programming. What you need to do is only have one loop to handle the messages (e.g. mouse events) and you will need to keep track some information for each object that is drawn (its state). If you want to change the color of the object every second, then you need to remember also the time at which the color changed previously, and before you draw your object, you check if you have to change the color or not.
|
|
|
|
|
I was recently given a brand new copy of a Game and Graphics textbook for C++ and I've been putting it to use. But I like to veer off and try things as I go that aren't explained in my reading materials. The book explained how to color sections of the screen, and from there I used the index to find out the other parts and attempted to combine a few functions I had been wanting to do before starting Visual programming. Nevertheless I plan on finishing the book and maybe it'll continue to help out.
|
|
|
|
|
You got to understand how an exe is build. There some steps. One is that the compiler translatet the h/cpp files into obj-files and than the linker grab the obj files and creates the exe.
Please refer for further details: http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx[^]
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|