Author Topic: [C++] Converting FreeBASIC Pointer Types into a Class  (Read 43428 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #80 on: September 25, 2009 »
Mate, the file you uploaded has *nothing* in it!

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #81 on: September 25, 2009 »
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
« Last Edit: September 25, 2009 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #82 on: September 25, 2009 »
NOOO!  Upload a file with the source code in!
Directory Listing of what you uploaded
Code: [Select]
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.
« Last Edit: September 25, 2009 by Jim »
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #83 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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #84 on: September 26, 2009 »
Ok here I go again with project_x :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #85 on: September 26, 2009 »
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.
« Last Edit: September 26, 2009 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #86 on: September 26, 2009 »
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:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #87 on: September 26, 2009 »
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:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #88 on: September 26, 2009 »
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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #90 on: September 26, 2009 »
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
« Last Edit: September 27, 2009 by Jim »
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #91 on: September 27, 2009 »
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.
« Last Edit: September 27, 2009 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #92 on: September 27, 2009 »
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)
« Last Edit: September 27, 2009 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1292
  • Karma: 466
    • View Profile
    • my stuff
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #93 on: September 27, 2009 »
Quote
error 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
Code: [Select]
int main(int argc, char *argv[])
{
}

"Windows" assumes a function called "WinMain" defined as
Code: [Select]
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:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #94 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
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #95 on: September 28, 2009 »
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:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #96 on: September 28, 2009 »
You should be OK to use libtinyptc_ext and set it to
SUBSYSTEM:WINDOWS
and use
int main()
{
...my code
}

Jim
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2750
  • Karma: 493
    • View Profile
    • http://www.rbraz.com/
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #97 on: September 28, 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
Code: [Select]
#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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #98 on: September 29, 2009 »
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.
« Last Edit: September 29, 2009 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C++] Converting FreeBASIC Pointer Types into a Class
« Reply #99 on: September 29, 2009 »
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?
Code: [Select]
#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: