|
Hi all,
I have started a project for an IDE using MFC Visual Studio Style Project.
I want to change the standar title of the FileView pane.
for this I changed the IDS_FILE_VIEW text.
But the result is not like expected.
On initial startup at top of the pane the new title is displayed correctly, but at button tabs there is still the old name "File View".
And if I switch between the tabs, the old name is displayed on pane's top too. In the whole project I cannot find other locations of the "File View" string, therefore I do not have any idea, how to change the behaviour!
Any ideas?
|
|
|
|
|
Basically code is from previous project my tutor helped me develop unfortunately I can no longer contact him, but I'm working on similar project which I did a simple object that moves around on screen, I pasted a pre-existing Direct X tool kit that my teacher gave me and imported it in as a project and did the linker with my other project but it's giving me the linker errors. Please kindly fix this there's no coding errors, also if possible please explain with screenshots what was wrong so I would remember for next time, thank you.
http://www.megafileupload.com/9c1m/P2BallGamev2.zip
modified 21-Aug-15 13:26pm.
|
|
|
|
|
No. Please at least post these "linker errors" of which you speak. Plus which compiler, OS, etc. you are using.
|
|
|
|
|

1>------ Build started: Project: P2BallGame, Configuration: Debug Win32 ------
1>SpriteResources.obj : error LNK2019: unresolved external symbol "public: __thiscall DirectX::SpriteBatch::SpriteBatch(struct ID3D11DeviceContext *)" (??0SpriteBatch@DirectX@@QAE@PAUID3D11DeviceContext@@@Z) referenced in function "public: __thiscall P2BallGame::SpriteResources::SpriteResources(class std::shared_ptr<class DX::DeviceResources>)" (??0SpriteResources@P2BallGame@@QAE@V?$shared_ptr@VDeviceResources@DX@@@std@@@Z)
1>PlayerBall.obj : error LNK2001: unresolved external symbol "public: __thiscall DirectX::SpriteBatch::SpriteBatch(struct ID3D11DeviceContext *)" (??0SpriteBatch@DirectX@@QAE@PAUID3D11DeviceContext@@@Z)
1>SpriteResources.obj : error LNK2019: unresolved external symbol "public: __thiscall DirectX::CommonStates::CommonStates(struct ID3D11Device *)" (??0CommonStates@DirectX@@QAE@PAUID3D11Device@@@Z) referenced in function "public: __thiscall P2BallGame::SpriteResources::SpriteResources(class std::shared_ptr<class DX::DeviceResources>)" (??0SpriteResources@P2BallGame@@QAE@V?$shared_ptr@VDeviceResources@DX@@@std@@@Z)
1>PlayerBall.obj : error LNK2001: unresolved external symbol "public: __thiscall DirectX::CommonStates::CommonStates(struct ID3D11Device *)" (??0CommonStates@DirectX@@QAE@PAUID3D11Device@@@Z)
1>SpriteResources.obj : error LNK2019: unresolved external symbol "public: __thiscall DirectX::SpriteFont::SpriteFont(struct ID3D11Device *,wchar_t const *)" (??0SpriteFont@DirectX@@QAE@PAUID3D11Device@@PB_W@Z) referenced in function "public: __thiscall P2BallGame::SpriteResources::SpriteResources(class std::shared_ptr<class DX::DeviceResources>)" (??0SpriteResources@P2BallGame@@QAE@V?$shared_ptr@VDeviceResources@DX@@@std@@@Z)
1>SpriteResources.obj : error LNK2019: unresolved external symbol "long __cdecl DirectX::CreateWICTextureFromFile(struct ID3D11Device *,struct ID3D11DeviceContext *,wchar_t const *,struct ID3D11Resource * *,struct ID3D11ShaderResourceView * *,unsigned int)" (?CreateWICTextureFromFile@DirectX@@YAJPAUID3D11Device@@PAUID3D11DeviceContext@@PB_WPAPAUID3D11Resource@@PAPAUID3D11ShaderResourceView@@I@Z) referenced in function "public: void __thiscall P2BallGame::SpriteResources::LoadTexture(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >)" (?LoadTexture@SpriteResources@P2BallGame@@QAEXV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)
1>PlayerBall.obj : error LNK2001: unresolved external symbol "long __cdecl DirectX::CreateWICTextureFromFile(struct ID3D11Device *,struct ID3D11DeviceContext *,wchar_t const *,struct ID3D11Resource * *,struct ID3D11ShaderResourceView * *,unsigned int)" (?CreateWICTextureFromFile@DirectX@@YAJPAUID3D11Device@@PAUID3D11DeviceContext@@PB_WPAPAUID3D11Resource@@PAPAUID3D11ShaderResourceView@@I@Z)
1>PlayerBall.obj : error LNK2019: unresolved external symbol "public: void __vectorcall DirectX::SpriteBatch::Begin(enum DirectX::SpriteSortMode,struct ID3D11BlendState *,struct ID3D11SamplerState *,struct ID3D11DepthStencilState *,struct ID3D11RasterizerState *,class std::function<void __cdecl(void)>,struct DirectX::XMMATRIX)" (?Begin@SpriteBatch@DirectX@@QAQXW4SpriteSortMode@2@PAUID3D11BlendState@@PAUID3D11SamplerState@@PAUID3D11DepthStencilState@@PAUID3D11RasterizerState@@V?$function@$$A6AXXZ@std@@UXMMATRIX@2@@Z) referenced in function "public: void __thiscall P2BallGame::PlayerBall::Render(void)" (?Render@PlayerBall@P2BallGame@@QAEXXZ)
1>P2BallGameMain.obj : error LNK2001: unresolved external symbol "public: void __vectorcall DirectX::SpriteBatch::Begin(enum DirectX::SpriteSortMode,struct ID3D11BlendState *,struct ID3D11SamplerState *,struct ID3D11DepthStencilState *,struct ID3D11RasterizerState *,class std::function<void __cdecl(void)>,struct DirectX::XMMATRIX)" (?Begin@SpriteBatch@DirectX@@QAQXW4SpriteSortMode@2@PAUID3D11BlendState@@PAUID3D11SamplerState@@PAUID3D11DepthStencilState@@PAUID3D11RasterizerState@@V?$function@$$A6AXXZ@std@@UXMMATRIX@2@@Z)
1>PlayerBall.obj : error LNK2019: unresolved external symbol "public: void __thiscall DirectX::SpriteBatch::End(void)" (?End@SpriteBatch@DirectX@@QAEXXZ) referenced in function "public: void __thiscall P2BallGame::PlayerBall::Render(void)" (?Render@PlayerBall@P2BallGame@@QAEXXZ)
1>P2BallGameMain.obj : error LNK2001: unresolved external symbol "public: void __thiscall DirectX::SpriteBatch::End(void)" (?End@SpriteBatch@DirectX@@QAEXXZ)
1>PlayerBall.obj : error LNK2019: unresolved external symbol "public: void __vectorcall DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *,struct DirectX::XMFLOAT2 const &,struct tagRECT const *,union __m128,float,struct DirectX::XMFLOAT2 const &,float,enum DirectX::SpriteEffects,float)" (?Draw@SpriteBatch@DirectX@@QAQXPAUID3D11ShaderResourceView@@ABUXMFLOAT2@2@PBUtagRECT@@T__m128@@M1MW4SpriteEffects@2@M@Z) referenced in function "public: void __thiscall P2BallGame::PlayerBall::Render(void)" (?Render@PlayerBall@P2BallGame@@QAEXXZ)
1>PlayerBall.obj : error LNK2019: unresolved external symbol "public: struct ID3D11BlendState * __thiscall DirectX::CommonStates::NonPremultiplied(void)const " (?NonPremultiplied@CommonStates@DirectX@@QBEPAUID3D11BlendState@@XZ) referenced in function "public: void __thiscall P2BallGame::PlayerBall::Render(void)" (?Render@PlayerBall@P2BallGame@@QAEXXZ)
1>P2BallGameMain.obj : error LNK2001: unresolved external symbol "public: struct ID3D11BlendState * __thiscall DirectX::CommonStates::NonPremultiplied(void)const " (?NonPremultiplied@CommonStates@DirectX@@QBEPAUID3D11BlendState@@XZ)
1>PlayerBall.obj : error LNK2001: unresolved external symbol "private: static struct DirectX::XMMATRIX const DirectX::SpriteBatch::MatrixIdentity" (?MatrixIdentity@SpriteBatch@DirectX@@0UXMMATRIX@2@B)
1>P2BallGameMain.obj : error LNK2001: unresolved external symbol "private: static struct DirectX::XMMATRIX const DirectX::SpriteBatch::MatrixIdentity" (?MatrixIdentity@SpriteBatch@DirectX@@0UXMMATRIX@2@B)
1>P2BallGameMain.obj : error LNK2019: unresolved external symbol "public: void __vectorcall DirectX::SpriteFont::DrawString(class DirectX::SpriteBatch *,wchar_t const *,struct DirectX::XMFLOAT2 const &,union __m128,float,struct DirectX::XMFLOAT2 const &,float,enum DirectX::SpriteEffects,float)" (?DrawString@SpriteFont@DirectX@@QAQXPAVSpriteBatch@2@PB_WABUXMFLOAT2@2@T__m128@@M2MW4SpriteEffects@2@M@Z) referenced in function "public: bool __thiscall P2BallGame::P2BallGameMain::Render(void)" (?Render@P2BallGameMain@P2BallGame@@QAE_NXZ)
1>P2BallGameMain.obj : error LNK2001: unresolved external symbol "private: static struct DirectX::XMFLOAT2 const DirectX::SpriteFont::Float2Zero" (?Float2Zero@SpriteFont@DirectX@@0UXMFLOAT2@2@B)
1>C:\Users\pedram\Documents\C++Menu\P2BallGame\Debug\P2BallGame\P2BallGame.exe : fatal error LNK1120: 11 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
|
|
|
|
|
From the first line, it looks you need the DirectXTK[^]. I see no prebuilt binaries there, probably you have to build it yourself from the sources.
|
|
|
|
|
Correct, I built it myself, can you show me or guide me on how to build it?, I need the simplemath.h files also included.
|
|
|
|
|
I would read the provided 'documentation', that is the Readme.txt file.
|
|
|
|
|
See here.
"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
|
|
|
|
|
Hi all,
I am starting to create a framework/IDE for special type of project files.
The GUI like Visual Studio would be perfect for my needs and it can be easily created wih assistance from MFC Application Wizard (Options: "MFC" + "Multiple Documents" + "Doc/View Architecture" + "Visual Studio Project Style")
But this solves only the "surface"...internally I need another structure...I have only one document, but I need to create a bunch of views for the document.
In the "File Explorer" view there should be viewed the structure of the document and in the child view area there should be viewed all views (like the "Tabbed Documents"), related to the document.
But I have absolutely no idea, how to solve this!
Are the any examples, I could use as templates? Or are there any general ideas, how to solve?
Many Thanks
Richard
|
|
|
|
|
When you create your project you select a CView derived class for the view of the document. You can add more different views or create some of your own. The MFC templates have a few options if I remembr correctly, and there are samples in the MSDN website and elsewhere[^].
|
|
|
|
|
yes, you are right. I have overseen this!
When I create a MDI application, I am able to create several views by default already.
Actually my application should act like an SDI application. One document, on which I have several views. But when selecting SDI style in VS Project Wizard, I do not have this "tabbed document" style, which I would need.
In the case I am using MDI style, my challenge is now, to manipulate the MDI behaviour, that it acts like SDI.
A bit weird, but seems to be the fastest approach.
If this approach is reasonable, I should create a new thread for it in the forum....
|
|
|
|
|
|
I am stuck again.
I have inherited this piece of code which basically associate SAM3X8E pins with hardware registers.
I think it is pretty clever usage of array of struct and it works fine.
The original code did not include convenient way to access ALL of the registers, so I am trying to build the missing registers from basis assignments.
The registers are related to "port" ( designated PIOA.. thru PIOF) so if I can get the port assigned to a pin I can build all of the missing registers.
Here is the code to get the the port info from first (test) pin:
P_DB is a pointer to pins array.
( I have left all of the support code here FYI )
....
regtype TEST = *P_DB.pPort; *p_DB[0] fails same way
//lcd_i2c.print( (int) P_DB[0].pPort, HEX); // test access first pin
...
Now here is the error message from compiler ( on TEST) and I have no idea how to fix it:
C:\DOCUME~1\Vaclav\LOCALS~1\Temp\build6265730787782115322.tmp\sketch\AAA_TFT_LCD.h: In member function 'void TFT_LCD::LCD_Writ_Bus(char, char, byte)':
C:\DOCUME~1\Vaclav\LOCALS~1\Temp\build6265730787782115322.tmp\sketch\AAA_TFT_LCD.h:4370:30: error: request for member 'pPort' in '((TFT_LCD*)this)->TFT_LCD::P_DB', which is of non-class type 'volatile uint32_t* [16] {aka volatile long unsigned int* [16]}'
regtype TEST = *P_DB.pPort;
The error on (int) P_DB[0].pPort, code is pretty much same.
I hope I have provided all of the info necessary so someone can suggest a solution on how to access the pPort member.
/* Types used for the tables below */
// theae are indexes to array - what a trick
//typedef struct _PinDescription
//{
// Pio* pPort ;
// uint32_t ulPin ;
// uint32_t ulPeripheralId ;
// EPioType ulPinType ;
// uint32_t ulPinConfiguration ;
// uint32_t ulPinAttribute ;
// EAnalogChannel ulAnalogChannel ; /* Analog pin in the Arduino context (label on the board) */
// EAnalogChannel ulADCChannelNumber ; /* ADC Channel number in the SAM device */
// EPWMChannel ulPWMChannel ;
// ETCChannel ulTCChannel ;
//} PinDescription ;
//
///* Pins table to be instanciated into variant.cpp */
//extern const PinDescription g_APinDescription[] ;
//// Number of pins defined in PinDescription array
//#define PINS_COUNT (79u)
//#define NUM_DIGITAL_PINS (54u)
//#define NUM_ANALOG_INPUTS (12u)
//
//#define digitalPinToPort(P) ( g_APinDescription[P].pPort ) so what is this refernce to .pPort
//#define digitalPinToBitMask(P) ( g_APinDescription[P].ulPin )
////#define analogInPinToBit(P) ( )
//#define portOutputRegister(port) ( &(port->PIO_ODSR) )
//#define portInputRegister(port) ( &(port->PIO_PDSR) )
//#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER )
//
///*
// * Pins descriptions
// * global array of all pins descriptions as what type
// * Arduino/hardware/arduino/sam/variants/arduino_due_x/variant.cpp
//
// */
//extern const PinDescription g_APinDescription[]=
//{
// // 0 .. 53 - Digital pins
// // ----------------------
// // 0/1 - UART (Serial)
// { PIOA, PIO_PA8A_URXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // URXD
// { PIOA, PIO_PA9A_UTXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // UTXD
//
// // 2
<a href=""></a>[<a href="" target="_blank">^</a>]
|
|
|
|
|
Firstly (and not for the first time) please put <pre> tags around your code so it is easy to read, (use the <t style="background-color:#FBEDBB">code link above the edit window) thus:
regtype TEST = *P_DB.pPort; *p_DB[0] fails same way
As to the error, you have Pio* pPort; in your structure, but you are trying to assign it to a regtype variable, so it needs a cast, or some conversion to the correct variable type.
|
|
|
|
|
Thanks, but I found I already have the port data and do not need the access to the struct after all.
|
|
|
|
|
I am trying to build SAM3x8E registers database.
I though I could use serial of #define(s) to do that but run into a problem
In this sample I can build PIO_SODR but I cannot add another (port) offset to it - see PIOA_SODR.
I think the problem is my defines are not really int (32 bits) , but only symbols.
I did compare the (symbol) PIO_SODR to its true hex value and it failed.
BUT - I can add the first offset of 0x30 no problem. Ether plain add (+) or (|) or works.
Any help would be as always appreciated.
#define SAM_MSB 0x400E //MSD upper 16 bits byte base
#define SAM_LSB 0xE00
#define PIO_OFFSET 0x200
#define PIO_SODR SAM_MSB << 16 | SAM_LSB + 0x30 // base plus reg offset OK
#define PIOA_SODR PIO_SODR + 0x200 // add in another offset fails
modified 20-Aug-15 13:13pm.
|
|
|
|
|
#defines are not even symbols - when the pre-processor runs it replaces the #define "tag" with the associated text. You probably want to add brackets to the PIO_SODR and PIOA_SODR definitions
e.g.
#define PIO_SODR (SAM_MSB<<16|SAM_LSB+0x30)
#define PIOA_SODR (PIO_SODR + 0x200)
|
|
|
|
|
I think I got part of the answer - I am mixing logical operations with math so that is why the first #define works ( compare to value) AFTER I added brackets.
#define PIO_SODR (SAM_MSB << 16 | SAM_LSB + PIO_OFFSET) now passes the value test OK
#define PIOA_SODR (PIO_SODR + PIO_OFFSET)
But the additional offset does not work, but I am getting closer.
Thank for your help.
And it also helps to check if my #define(s) are not duplicated somewhere else !!!
Thanks
modified 20-Aug-15 15:08pm.
|
|
|
|
|
|
Mainly because the "core" program is build using defines and I am still not too comfortable using enum.
BTW after I "solved" this problem I have decided to "improve" on on it a got stuck again.
Life is fun.
|
|
|
|
|
I can only agree with Carlo on this. More generally, whenever there is a suitable way to use standard language features instead of #define, use that standard language feature. Even if it means you need to type more!
Modern editors offer autocompletion that makes typing effort a non-argument! Moreover, code riddled with #define macros is much harder for editors to interpret, preventing it from offering correct and complete autocompletion lists. Therefore the use of #define has the very real potential to actually increase the typing effort by hamstringing the editors capabilities!
Besides, as you've already stated, #defines will just keep tripping you up. Most of the time it is due to their entire lack of context-related syntax checking at the time of writing. And sometimes it is because your macro name conflicts with another non-macro symbol in some totally unrelated part of the code - that latter issue will lead to obscure errors that can keep you busy for days. I am speaking from my own experience.
Therefore: save time - do not use #define unless there is no other way to achieve the intended results. And if you do, don't place these macros in a header that gets included in unrelated source files - either put them right into the source file that needs them, or, if there are multiple source files that need them, put the macros in a separate header just for that purpose.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I would like to know how to send a text file from C to java, in which java has to receive the file and send it back to C. I have developed the code, but i am facing error in the receive function
#include<time.h>
#include<errno.h>
#include<stdio.h>
#include<fcntl.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<sys stat.h="">
#include<sys time.h="">
#include<sys ioctl.h="">
#include<sys types.h="">
#include<arpa inet.h="">
#include<sys select.h="">
#include<sys socket.h="">
int send_text(int socket)
{
FILE *text;
char a[50];
int size, read_size, stat, packet_index;
char send_buffer[8008], read_buffer[8008];
int wrt=0,sock_fd,tsize=0;
packet_index = 1;
int i=0;
text = fopen("/home/sosdt009/Desktop/character3.txt", "r");
if (text == NULL)
{
printf("Error Opening text File:");
exit(-1);
}
printf("Getting text Size:\n");
gets(a);
fseek(text, 0, SEEK_END);
size = ftell(text);
fseek(text, 0, SEEK_SET);
printf("Total text size: %d \n", size);
gets(a);
printf("Sending text Size:\n",size);
gets(a);
send(socket, (void *)&size, sizeof(size), 0);
while(stat < 0)
printf("Socket data:%s \n", read_buffer);
gets(a);<br />
while(size>tsize)
{
read_size = fread(send_buffer,1,sizeof(send_buffer),text);
printf("The size of send buffer:%c \n",send_buffer);
gets(a);
printf("The read size value is :%d \n", read_size);
gets(a);
do
{<br />
stat = send(socket, send_buffer, read_size, 0);
printf("The send size value is: %d \n", size);
gets(a);
printf("The read size value is: %d \n", read_size);
gets(a);
} while (stat < 0);
printf("Packet %d, sent %d bytes.\n", packet_index, read_size);
gets(a);
tsize = tsize+read_size;
printf("The tsize value is:%d \n",tsize);
gets(a);
memset(send_buffer,0, sizeof(send_buffer));
if(read_size<=NULL)
{
printf("The connection is transferred to received text: \n");
gets(a);
}
}
fclose(text);
printf("Text successfully send:\n");
gets(a);
return 0;
}
int receive_text(int socket)
{
int buffersize = 77,recv_size=0,read_size = 1, write_size,size;
char *pBuf,a[50],b[77];
int errnom,i;
FILE *textnew;
size_t rec;
textnew = fopen("/home/sosdt009/Desktop/receivednew.txt", "a");
if (textnew == NULL)
{
printf("Error has occurred, text file could not be opened \n");
return -1;
}
while(read_size > 0)
{
printf("The Buffersize is :%d\n",buffersize);
gets(a);
printf("The size of socket is:%d\n",socket);
gets(a);
if (buffersize > 0)
{
printf("Buffersize value is :%d\n", buffersize);
gets(a);
pBuf = malloc(sizeof(b));
if (!pBuf)
{
printf(errnom, "Memory Error Cannot Allocate!\n");
gets(a);
exit(-1);
}
read_size = recv(socket,pBuf,sizeof(pBuf),1);
printf("Read size value is :%d \n",read_size);
gets(a);
printf("Buffersize value is:%d \n",sizeof(pBuf));
gets(a);
write_size = fwrite(pBuf,1,sizeof(pBuf),textnew);
free(pBuf);
printf("Write size value is :%d \n",write_size);
gets(a);
printf("Buffer size value is :%d \n",sizeof(pBuf));
gets(a);
recv_size += read_size;
printf("Received size value is:%d \n",recv_size);
gets(a);
printf("Read size value is :%d \n",read_size);
gets(a);
}
}
free:
fclose(textnew);
close(socket);
printf("Text Successfully Received:\n");
gets(a);
return 0;
}
int main(int argc,char *argv[])
{
int socket_desc;
struct sockaddr_in server;
char *parray,errnomu;
socket_desc = socket(AF_INET,SOCK_STREAM,0);
if(socket_desc == -1)
{
printf("Could not create socket \n");
}
memset(&server,0,sizeof(server));
server.sin_addr.s_addr = inet_addr("10.170.0.38");
server.sin_family = AF_INET;
server.sin_port = htons(6999);
if (connect(socket_desc,(struct sockaddr *)&server , sizeof(server)) < 0)
{
printf(strerror(errnomu));<br />
printf("Connect Error \n");
return -1;<br />
}
puts("Connected");
send_text(socket_desc);
receive_text(socket_desc);
close(socket_desc);
return 0;
}
|
|
|
|
|
|
venkat28vk wrote: ...but i am facing error in the receive function And you are withholding that error for what reason?
You seriously need to remove all but the relevant pieces of code. Otherwise, few, if any, people will bother to wade through it all.
"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
|
|
|
|
|
Agree with Mr David, what type of error are you facing? is at compile time or runtime.. are you able to send file to JAVA Client? or it problem sending from java client to c++?
|
|
|
|
|