Linking two .cpp and a .h files

后端 未结 8 895
小蘑菇
小蘑菇 2021-02-02 01:00

I\'m doing an exercise (from the third chapter of Thinking in C++) but I have a problem linking two .cpp files.

This is the exercise:

Create a h

8条回答
  •  余生分开走
    2021-02-02 02:01

    For those like me who may be using the IDE BloodShed Dev C++.

    Create a project folder then proceed to place your H files and your CPP files inside your project folder.

    I had the same problem as mentioned above, the conclusion I came upon was that my compiler was only compiling the H files and wouldn't even read the CPP files linked to it. When I put them in a project folder my compiler would compile all files together hence allowing my code to run.

    Here is a link of creating a project folder for those using Bloodshed.

    http://www.horstmann.com/bigcpp/help/bloodshed/index.html

    As for other IDE users, I believe the problem to be similar. IF anyone needs further elaboration just let me know.

提交回复
热议问题