• Welcome to Dark Bit Factory & Gravity.
 

[C++] Converting FreeBASIC Pointer Types into a Class

Started by Clyde, August 14, 2009

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Jim

Mate, the file you uploaded has *nothing* in it!

Jim
Challenge Trophies Won:

Clyde

How strange it was about 2megs. I'll reupload it.
Just downloaded it again, all of the stuff has gone into the debug folder of Axium. it should be in the release as thats what build i opted for.

Axium - > Axium -> Debug
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Jim

NOOO!  Upload a file with the source code in!
Directory Listing of what you uploaded

C:\Users\Jim\Desktop\Axium\Axium
C:\Users\Jim\Desktop\Axium\op.txt
C:\Users\Jim\Desktop\Axium\Axium\Axium
C:\Users\Jim\Desktop\Axium\Axium\Axium.ncb
C:\Users\Jim\Desktop\Axium\Axium\Axium.sln
C:\Users\Jim\Desktop\Axium\Axium\Debug
C:\Users\Jim\Desktop\Axium\Axium\Release
C:\Users\Jim\Desktop\Axium\Axium\Axium\Axium.vcproj
C:\Users\Jim\Desktop\Axium\Axium\Axium\Axium.vcproj.MIKES-GATEWAY.Mike Furlong.user
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\Axium.exe.embed.manifest
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\Axium.exe.embed.manifest.res
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\Axium.exe.intermediate.manifest
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\bitmap scroller 1-4.obj
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\BuildLog.htm
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\us64x64_pal.obj
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\us64x64_raw.obj
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\vc90.idb
C:\Users\Jim\Desktop\Axium\Axium\Axium\Debug\vc90.pdb
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\Axium.exe.intermediate.manifest
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\bitmap scroller 1-4.obj
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\BuildLog.htm
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\mt.dep
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\us64x64_pal.obj
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\us64x64_raw.obj
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\vc90.idb
C:\Users\Jim\Desktop\Axium\Axium\Axium\Release\vc90.pdb
C:\Users\Jim\Desktop\Axium\Axium\Debug\Axium.pdb
C:\Users\Jim\Desktop\Axium\Axium\Release\Axium.exe
C:\Users\Jim\Desktop\Axium\Axium\Release\Axium.pdb


No C or CPP or LIB files.
Challenge Trophies Won:

Rbz

Quote from: Jim on September 25, 2009
NOOO!  Upload a file with the source code in!
hehe  :)

@Clyde: please search these missing files:
Quote..\..\Bitmap Scroller 1-1\Bitmap Scroller 1-1\bitmap scroller 1-4.cpp
..\..\graphics\us64x64_pal.cpp
..\..\graphics\us64x64_raw.cpp



Challenge Trophies Won:

Clyde

Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Clyde

And here are the external bits.

which i have added to the options part that has the locations of the includes and headers etc.

thanks for your help,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Clyde

I know this has gone a bit a stray, but i promise it will get back to classes. ;)
And sorry if i've messed people about.

What I think I should do is go back to basics of generating a project / starting VS C++ 2008 express a fresh.

1/ What's the difference between a console application and a win32 application ( both of which I choose the empty option )?

As I can run console projects, still get that annoying warning of crt cpu.object. And I was under the impression that win32 app is a program that does away with the black dos window. Do I need to change main?

presently, in a console app: void main()
And I use the same for a Win32 app, but as you know these do not work properly, and tell me about CIL.


Thank you for your patience, time and help getting me through these, I can almost smell the secret of success! ;)

Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Jim

A console application opens a command window by default (like some FB programs do), it can use this for logging and console input.  A windows program doesn't do that.
A console application has the entry point:
int main(void)
{
...your program
}

A win32 program has the entry point:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
...your program
}

Jim
Challenge Trophies Won:

Jim

In the new zip files we're still missing some of the code files.  The ones that have us64_pal etc. in them.  Please don't post the .ncb file, it's 2Mb and isn't any use to anyone.

Jim
Challenge Trophies Won:

Clyde

Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Jim

You're still not posting the actual code you're having the problem with, because this project file (vcproj) doesn't even have a reference to the tinyptc library in it!  I really don't understand why you can't just post all the .cpp, .c, .h, and .vcproj files, and only those files, how hard is that to do?

However, I think the solution to your warnings is
Project->Properties->Configuration Properties->C++->Code Generation
and change Runtime Library to be
Multi-threaded Debug (/MTd)
you'll need to change it in the Release configuration as well, to
Multi-threaded (/MT)

<edit>
You'll also need to set it back to Console mode or fix your main to be WinMain for it to do anything.

Jim
Challenge Trophies Won:

Clyde

Thankyou will try that out.

with the includes / libs and headers, i have those added at the VC++ directories, where you'd have the platform sdk / direct sdk, etc. I did this as i thought it be easier than having to constantly add them to a new project. I did include all that i have, plus extras thats got the external stuff.

So that might explain why they arent in the project_x project.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Clyde

I have done a fresh install of VS C++ Express 08.

I keep getting with a win32 project:
1>libtinyptc_ext.lib(tinyptc.obj) : error LNK2001: unresolved external symbol _main

this is what i have as my main:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

hellfire

Quoteerror LNK2001: unresolved external symbol _main
In your project properties (that's what appears when you press Alt+F7) there's a tree on the left.
Under "Configuration Properties" there's an entry "Linker", under "Linker" there's an entry "System" - select it.
On the right a couple of options appear.
In the option "SubSystem" you can select either "Console" or "Windows".

"Console" assumes a function called "main" which should be defines as
int main(int argc, char *argv[])
{
}


"Windows" assumes a function called "WinMain" defined as
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
}


if you use "Console" (and the associated main(...) function), a console windows opens automatically when your application starts. That's because C++ originates from unix development and expects some sort of textual output device.
This is quite useful as long as you're in development to print all sorts of debug-infos.

For "Windows" applications (with the associated WinMain(...) function) this is usually undesired as there's some sort of gui.

Please recapitulate what I wrote earlier about storing project- and source-files in a single place to avoid mess-up.
Challenge Trophies Won:

Jim

Actually, I couldn't make this work either.  I think libtinyptc_ext.lib already defines WinMain or WinMainCRTStartup and itself it calls main.  Something to do with how it works in FB.
That's a bit odd, but it means that Clyde should use
int main(void)
{
}
even when he has his linker set to WINDOWS, but only when using libtinyptc_ext.
Maybe rbz can confirm?

Jim
Challenge Trophies Won:

Clyde

Ah so it seems there's something a foot in tinyptc.
I wonder if there is anything similar that I can use temporarily?
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Jim

You should be OK to use libtinyptc_ext and set it to
SUBSYSTEM:WINDOWS
and use
int main()
{
...my code
}

Jim
Challenge Trophies Won:

Rbz

Quote from: Jim on September 27, 2009
Actually, I couldn't make this work either.  I think libtinyptc_ext.lib already defines WinMain or WinMainCRTStartup and itself it calls main.  Something to do with how it works in FB.
That's a bit odd, but it means that Clyde should use
int main(void)
{
}
even when he has his linker set to WINDOWS, but only when using libtinyptc_ext.
Maybe rbz can confirm?

Jim
Yes, that's how Gaffer did it
#ifdef __PTC_WINMAIN_CRT__

    extern int main();
    void WinMainCRTStartup()
    {
        main();
    }

#endif


Here's a little fix for building console and windows projects without producing crt warnings, just go to "Project/Properties" and add "WinMainCRTStartup" to the entry point.
Challenge Trophies Won:

Clyde

Extreme thanks to all :)

Now it's not running the program after pressing F5.
in console option it works with not using WinMainCRTStartup, and in windows option neither work.

Is it ok to add what I call libraries that I more often than not use on a regular basis to the projects and solutions info? Stuff like tinyptc, and my work in progress 2d lib. Or should I be copying them over into the headers and source code parts of a project?

As im trying to work out the problems im having, as its funny how the first few projects worked in linker -> system -> subsystem -> Windows (/SUBSYSTEM:WINDOWS) ( btw there is a windowsce )

As im thinking maybe some files get corrupted or something, not entirely sure.

<edit> I had to revert back from mt multi threaded back to the multithreaded dll. I also used the entry point fix, but i still got the errors back.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Clyde

Righty here's the last of my adventures with MSVC. as i cant even get a program to run properly.

Is this causing me grief and is it needed?

#ifdef __PTC_WINMAIN_CRT__

    extern int main();
    void WinMainCRTStartup()
    {
        main();
    }

#endif


Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won: