![]() |
|
#1
|
|||
|
|||
issues compiling .h and .cpp files with Dev C++I'm having a problem compiling a .h and .cpp file in Dev C++. I'm sure it is something simple I am overlooking, but for the life of me I can't figure it out. I am creating a new project and inserting two .h and one .cpp files into the project. When I compile, I get multiple errors. Normally I just consolidate the .h into the .cpp file, but when I do that with these files I get errors as well.
The I'm fairly certain the files are valid as they are examples out of the text book. The code is extremely long so I've attached are the files I'm working with. I changed the extension to .txt to upload the files. The correct extensions are linkedList.h orderedLinkedList.h and testProgLinkedList.cpp Thanks in advance. |
|||
|
#2
|
||||
|
||||
Re: issues compiling .h and .cpp files with Dev C++I do not have Dev C++, but those files compiled without error with MS Visual C++ 6.0.
Can you possibly post the first several errors (if not a few more)? Most users here probably won't bother with those files (as mentioned in the guidelines), but will know what the error message(s) might indicate. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
|||
|
|||
Re: issues compiling .h and .cpp files with Dev C++Code:
Someone on another forum told me to use "this->first" and not to use "using namespace" clause in header files. Instead, prepend all of those names with "std::". I will try those suggestions and see what happens. I tried to compile using MS Visual C++ and got different errors. I'm not at my home computer right now so I can't tell you the exact error. I will post it later. Last edited by cable_guy_67 : 16-May-2006 at 21:21.
Reason: added [code] ... [/code] tags to stop smilies
|
|
#4
|
|||
|
|||
Re: issues compiling .h and .cpp files with Dev C++Below are the errors I get with MS Visual C++ 6.0. Is there another post that goes step by step creating a project with existing header and c++ files? Maybe I'm doing something wrong there.
--------------------Configuration: LINK - Win32 Debug-------------------- Compiling... testProgLinkedList.cpp c:\link\linkedlist.h(30 c:\link\linkedlist.h(105) : see declaration of 'first' C:\LINK\testProgLinkedList.cpp(25) : see reference to function template instantiation 'class std::basic_ostream<char,struct std::char_traits<char> > &__cdecl operator <<(class std::basic_ostream<char,struct std::char_traits<char> > &,const c lass linkedListType<int> &)' being compiled Error executing cl.exe. testProgLinkedList.obj - 1 error(s), 0 warning(s) |
|
#5
|
||||
|
||||
Re: issues compiling .h and .cpp files with Dev C++I have formatted the content of the files in this post; I advise you not to post code in attached files, because very few people will read it, and thus you will get less help.
linkedList.h CPP / C++ / C Code:
orderedLinkedList CPP / C++ / C Code:
testProgLinkedList.cpp CPP / C++ / C Code:
Best regards, Lucian __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#6
|
||||
|
||||
Re: issues compiling .h and .cpp files with Dev C++With my MS VC++, I created an empty 'Win32 Console Application', added your files to the source and header folders. After build, there were no errors.
After a quick test run, I saw the 'Line 3:...' message, but that's as far as I went. Try that and let us know how it goes. If I get a chance later today, I'll try building your files with g++. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#7
|
|||
|
|||
Re: issues compiling .h and .cpp files with Dev C++I didn't want to post the whole code before because I thought it was too long. Hopefully in the future I will only need help with portions of my code, not the whole thing.
OK, I tried this again and I'm still getting the same errors. Here's what I'm doing. Once I create an empty 'Win32 Console Application' project I click Project, Add to project, Files. I have placed the .h and .cpp files in the same folder as the project. I select the .h and .cpp files and click OK. The files show up under the project. Next I click on Globals and double click main(). I then select Build, Compile testProgLinkedList.cpp, after the code compiles, I get the errors. |
|
#8
|
|||
|
|||
Re: issues compiling .h and .cpp files with Dev C++I installed Visual Studio 2005 and tried compiling and still got errors. So I did some more research and found the following reference.
http://www.parashift.com/c++-faq-lit...html#faq-35.16 So I changed the following section of my code: CPP / C++ / C Code:
It works! By the way I just received my free copy of Visual Studio 2005 a couple of days ago by going to this web site http://www.learn2asp.net/Campaign.aspx. You just need to take a couple of tutorials and you will get the software in about a month. |
|
#9
|
||||
|
||||
Re: issues compiling .h and .cpp files with Dev C++Good, glad to see you got it going.
VC++ 6 still does not give me errors, but when I compiled with g++, it gave the same errors that you got. Is that Visual Studio 2005, the express version? If so, there's no need to take any tutorials, Micro$oft is offering the express version free here: http://msdn.microsoft.com/vstudio/express/visualc/ __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#10
|
|||
|
|||
Re: issues compiling .h and .cpp files with Dev C++It's not express. It's standard edition with 2 CDs. It comes with lots of other things too. If you go to the link they tell you what you get. If you download the tutorials, it counts as taking them, so just download 3 tutorials and the software will be in the mail.
|
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Doxygen comments in .h or .cpp? | seabreeze | C++ Forum | 0 | 02-Apr-2006 03:47 |
| User defined headers | davis | Miscellaneous Programming Forum | 6 | 16-Feb-2006 19:40 |
| Bloodshed Dev C++ Project Options | JdS | C++ Forum | 6 | 11-Nov-2005 18:23 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The