Jump to content
  • Advertisement
Sign in to follow this  
ChrisPepper1989

Cant get anything started in VS C++ PLEASE HELP

This topic is 4078 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey ive been programming for two years now and started using OpenGL last year, however i have always used borland C++ and now i have decided to start using VS as that is what i will be using at uni next year however i cant seem to get anything started! and its driving me mad! ive tried past projects of my own, VS basecode from nehe, tutorials off my gamedev disk and everytime VS seems to have a problem with it! Basically everything i try and compile will have at least one wierd error and so far ive not seen one single thing compile! I solved many errors after i downloaded and installed the windows SDK and some more were solved by linking GL libaries to the program but VS likes to come up with this error: 1>LINK : fatal error LNK1104: cannot open file 'glaux.lib' even when there is no pragma link to it. in other cases it likes to come up with: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int which if i block with #pragma warning( disable : 4430) it likes to get up to linking and then give out lots of linker errors like this: error LNK2019: unresolved external symbol __imp__CoInitialize@4 referenced in function _WinMain@16 now that particular error was in the case of a tutorial off my game dev disk! can someone please help me, perhaps send me some openGL base code that they know works with VS C++ 2005 and then if that still comes up with errors i can try and find out what im missing! PLEASE im going insane here! any help will be much apreciated! Info: I have windows XP. Visual studios C++ express edition 2005 Installed the windows SDK Installed the DirectX 10 SDK and atempted to add openGL files to the correct directories using my book (note this could easily be were the problem lies!) i get a variety of different errors so far nothing has even run in VS when i fix 1 error, that is apparently the last one it will either come up with another 60 or have 100 linker errors! i never had this many problems in borland but i get the feeling that borland is more noobish friendly in comparison to VS C++. Please, please help all these compiller errors are really dragging me down ive not actually been able to get stuck into writting any decent code in weeks and any programmer will know how frustrating that can be! Thanks for your time and any help given :-), Chris

Share this post


Link to post
Share on other sites
Advertisement
I've run through the first I belive 21 NeHe lessons, and with a couple changes here and there, at the most, everything compiled in DevC++. Doesn't VC++ have a linker place you can use other than pragma comments? Here's what I use for linkers in opengl:
-lopengl32 -lglu32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32


good luck. Hope this helps.

Share this post


Link to post
Share on other sites
Linker place? i dont know, 2bh i dont really know anything about the program as ive only started using it, those lines you added can they all be found in default directories?

i know of a directories part were you specifies place to link, if thats what you mean and ive included the directories that have openGL headers and libaries and it still doesnt work. do you use DevC++ then i take it? can you send me some of your modified code and ill see what VS says about that?

im pretty sure it must have something to with the way VS is set up at the minute, im also pretty sure that these errors wouldnt be here if i had the full version im pretty sure its microsofts way of saying yer we will give you the program for free but nothing under the sun will work in it unitill you sell your left kidney to buy the full suite

Thanks,

Share this post


Link to post
Share on other sites
Quote:

im pretty sure it must have something to with the way VS is set up at the minute, im also pretty sure that these errors wouldnt be here if i had the full version im pretty sure its microsofts way of saying yer we will give you the program for free but nothing under the sun will work in it unitill you sell your left kidney to buy the full suite

Actually, I'm pretty sure you just didn't install everything properly.

Quote:

1>LINK : fatal error LNK1104: cannot open file 'glaux.lib'

glaux, being largely an ancient piece of trash, does not come with the PSDK distribution of OpenGL. You'll have to find it elsewhere, use a replacement (I think NeHe's got one), or refactor your code to remove it.

Quote:

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Suggests you have an error leading the compiler to assume you are declaring a function when you are not. Possibly missing semicolons somewhere, et cetera, or missing types due to improperly configured headers.

Quote:

error LNK2019: unresolved external symbol __imp__CoInitialize@4 referenced in function _WinMain@16

CoInitialize is in ole32.lib, are you linking with that (libraries to link with are specified via #pragma comment, or via the Project Options -> Linker -> Inputs section).

If you are linking with it, you didn't install and configure the Platform SDK properly, and you should go back and review the directions.

Share this post


Link to post
Share on other sites
Quote:
Original post by ChrisPepper1989
Hey ive been programming for two years now and started using OpenGL last year, however i have always used borland C++ and now i have decided to start using VS as that is what i will be using at uni next year however i cant seem to get anything started! and its driving me mad! ive tried past projects of my own, VS basecode from nehe, tutorials off my gamedev disk and everytime VS seems to have a problem with it!

Basically everything i try and compile will have at least one wierd error and so far ive not seen one single thing compile!

I solved many errors after i downloaded and installed the windows SDK and some more were solved by linking GL libaries to the program but VS likes to come up with this error:

1>LINK : fatal error LNK1104: cannot open file 'glaux.lib'

even when there is no pragma link to it.
in other cases it likes to come up with:

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

which if i block with #pragma warning( disable : 4430)
it likes to get up to linking and then give out lots of linker errors like this:

error LNK2019: unresolved external symbol __imp__CoInitialize@4 referenced in function _WinMain@16

now that particular error was in the case of a tutorial off my game dev disk!

can someone please help me, perhaps send me some openGL base code that they know works with VS C++ 2005 and then if that still comes up with errors i can try and find out what im missing! PLEASE im going insane here! any help will be much apreciated!

Info:
I have windows XP.
Visual studios C++ express edition 2005
Installed the windows SDK
Installed the DirectX 10 SDK
and atempted to add openGL files to the correct directories using my book (note this could easily be were the problem lies!)

i get a variety of different errors so far nothing has even run in VS when i fix 1 error, that is apparently the last one it will either come up with another 60 or have 100 linker errors!

i never had this many problems in borland but i get the feeling that borland is more noobish friendly in comparison to VS C++.

Please, please help all these compiller errors are really dragging me down ive not actually been able to get stuck into writting any decent code in weeks and any programmer will know how frustrating that can be! Thanks for your time and any help given :-), Chris
Did you follow These steps?

EDIT: Bah, too slow [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by ChrisPepper1989
1>LINK : fatal error LNK1104: cannot open file 'glaux.lib'

So, obvious question. Do you have this file? Where is it located? (And do you need it? If not, don't link to it)
Check your linker settings under project properties to see what you're trying to link in.

Quote:

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Which means there's a syntax error that should be fixed. The compiler thinks you're trying to declare a function without specifying its return type (which is illegal). Are you? If not, there's another error leading it to believe this.

Quote:

error LNK2019: unresolved external symbol __imp__CoInitialize@4 referenced in function _WinMain@16

Which means it can't find the function. Most likely because some library isn't being linked in correctly.

Quote:

now that particular error was in the case of a tutorial off my game dev disk!

What exactly is your game dev disk?

Quote:

i get a variety of different errors so far nothing has even run in VS when i fix 1 error, that is apparently the last one it will either come up with another 60 or have 100 linker errors!

Which just means your fixing the first errors, have made further errors visible to the compiler. That's not a bad thing.

Quote:

i never had this many problems in borland but i get the feeling that borland is more noobish friendly in comparison to VS C++.

More likely, the borland compiler just isn't very good at following the C++ standard. That's not noobish friendly, quite the opposite.

Either start from some simpler code, and get that working, or at least post your code so we can see it. It's a bit hard to tell you what you're doing wrong when we don't know what you're doing.

Share this post


Link to post
Share on other sites
Quote:
Original post by ChrisPepper1989 im also pretty sure that these errors wouldnt be here if i had the full version im pretty sure its microsofts way of saying yer we will give you the program for free but nothing under the sun will work in it unitill you sell your left kidney to buy the full suite
Nonsense... Microsoft provides the best free IDE out there. It is absolutely fully functional--unless you need the professional features (which you probably don't)--and has no usage restrictions.

You just have to learn to use it. In addition to the info already linked, you should also know...

If you right-click on project and select "Properties", you can:

-- add additional library paths under "Linker->General"
-- add additional libs (from those paths) under "Linker->Input"
-- add additional include paths under "C/C++->General

There is a lot of other stuff under that properties menu, also.


Share this post


Link to post
Share on other sites
ok thanks jpetrie, Spoonbender and Evil Steve ill start looking at those now!

to evil steve, originally i downloaded a different SDK and not that specific one, so ill try that and see were the other steps take me, im not looking forward to downloading another SDK but here goes anyway!

to jpetrie, yer but thing is i dont know what i did wrong, when asked i just insalled everything and it just never worked. yer i found the glaux fixer but wasnt really sure how to use it, im still a noob when it comes to these things! When i check out the int error it leads me to this line:
WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int nCmdShow) //i assume the problem is here as HINSTANCE, LPSTR dont name a variable
{ //and stops here
int loopRet;
and at the mo i dont have any pragma links! as i say im trying to get started using code already written on my gave dev tutorials, i supose i should just start from scratch really!

to Spoonbender, im guesing to not link to it you add its path in exclutions so ill try that. The game dev disk came with my book "OPENGL GAME programming" part of the "the premier press Game develpment series" by kevin hawkins and dave astle. Ie http://glbook.gamedev.net/oglgp.asp (if im allowed to do that)! And yer your ight, as i said above i should really just start from scratch again, i just cant bare the thought though :-(!! time to bite the bullet me thinks! yer i supose borland has just taught me bad habits and fooled me into thinking i can get away with alot of stuff!

To everyone THANKS FOR ALL YOUR HELP, i really do appreciate it! ill go away now download the SDK install it and start writing from page 1 of my book again, then post again with my progress! and if i have any errors with that code, ill post it, at the moment i keep trying to compile bits of old code and other peoples code just hoping to see something compile, which clearly isnt working so i should just bin all that!

Cya, time for me to start on the caffine!

Share this post


Link to post
Share on other sites
Quote:
Original post by smitty1276
Quote:
Original post by ChrisPepper1989 im also pretty sure that these errors wouldnt be here if i had the full version im pretty sure its microsofts way of saying yer we will give you the program for free but nothing under the sun will work in it unitill you sell your left kidney to buy the full suite
Nonsense... Microsoft provides the best free IDE out there. It is absolutely fully functional--unless you need the professional features (which you probably don't)--and has no usage restrictions.

You just have to learn to use it. In addition to the info already linked, you should also know...

If you right-click on project and select "Properties", you can:

-- add additional library paths under "Linker->General"
-- add additional libs (from those paths) under "Linker->Input"
-- add additional include paths under "C/C++->General

There is a lot of other stuff under that properties menu, also.


Ahhh thanks that will also be of help, so far ive just been going into tools->Options->Projects and solutions->VC++ directories. Which to be honest makes me fear that im screwing things up further! yer i gues im just a bit cynical about microsoft, we just generally dont seem to get along!

Share this post


Link to post
Share on other sites
I re-installed the SDK, which although it did nothing, at least now ive got the most up-to-date version! i re-liked all my lib and include folders which again did nothing but at least i knew enough about it to tidy the thing up! However it was Evil Steve's magic link to the steps on what to do, that solved the problem (you can now go into smug mode if you wish) particularly
Step 4: Update the corewin_express.vsprops file.
Step 5: Generate and build a Win32 application to test your paths.(update AppSettings.htm)

which i had no idea about! After this the flows of errors seemed to go away and i saw a magical thing! my first compilled program in VC++!!!!!! :-)!!!

i couldnt of done this without all your help, evil steves steps helped me configure it properly once and for all, the new SDK prompted me to relink all my directories and Glaux.lib was for some reason no longer linked! which i wouldnt of checked out if it wasnt for Spoonbender and jpetrie! i also have a nice way of linking extra files thanks to smitty1276! and thanks to brandonman for your advice i have a sneaking feeling that will come in handy! I would also like to say that if it wasnt for everyones input i wouldnt know that litle bit more about VC++ so now its a little less scary as i have a bit of a head start on things like general errors,linking and lib problems!

Thanks to everyone for your time and help on this post, i can finally program again!!!! i feel a bit of geek being so happy of that fact but sod it!!!
:-)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!